1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9091],{68552:function(e,a,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/reservations/[id]",function(){return t(98209)}])},7092:function(e,a,t){"use strict";t.d(a,{Z:function(){return h}});var s=t(85893),l=t(67294),n=t(44389),r=t(84858),i=t(32474);let d=[{key:"out-host",label:"با Ù
ÛØ²Ø¨Ø§Ù",direction:"OUTBOUND",party:"HOST"},{key:"in-host",label:"از Ù
ÛØ²Ø¨Ø§Ù",direction:"INBOUND",party:"HOST"},{key:"out-guest",label:"با Ù
ÙÙ
اÙ",direction:"OUTBOUND",party:"GUEST"},{key:"in-guest",label:"از Ù
ÙÙ
اÙ",direction:"INBOUND",party:"GUEST"}],c=["Ø§ÙØ§Ù
تگا٠پرÙ","Ù
ÛØ²Ø¨Ø§Ù اÙÚ©Û","Ù
Ø³Ø§ÙØ± پرداخت Ù
ÛÚ©ÙÙ","Ù
ÛØ²Ø¨Ø§Ù Ø¬ÙØ§Ø¨ ÙØ¯Ø§Ø¯","Ù
ÙÙ
Ø§Ù Ø¬ÙØ§Ø¨ ÙØ¯Ø§Ø¯","ÙÛÙÚ© پرداخت"],o="bg-[#03D6BB14] text-[#015046] border-[#03D6BB]",x="bg-[#E8F1FF] text-[#1B4F9C] border-[#1B4F9C]",m={CALL:{label:"تÙ
اس",icon:"icon-PhoneFill",chip:"bg-gray-F0F0F0 text-gray-6C6A7D border-gray-E5E5E6"},NOTE:{label:"ÛØ§Ø¯Ø¯Ø§Ø´Øª",icon:"icon-Edit",chip:"bg-gray-F0F0F0 text-gray-6C6A7D border-gray-E5E5E6"},STATE_CHANGE:{label:"تغÛÛØ± ÙØ¶Ø¹Ûت",icon:"icon-Refresh",chip:"bg-[#FFF4E0] text-[#B26A00] border-[#FFB74D]"},FIELD_CHANGE:{label:"تغÛÛØ± Ø§Ø·ÙØ§Ø¹Ø§Øª",icon:"icon-Filters",chip:"bg-[#FFF4E0] text-[#B26A00] border-[#FFB74D]"},MESSAGE_SENT:{label:"Ù¾ÛØ§Ù
ارساÙÛ",icon:"icon-message",chip:"bg-[#F1EAFE] text-[#5B32B0] border-[#5B32B0]"}},u=[{key:"",label:"ÙÙ
Ù"},{key:"CALL",label:"تÙ
اسâÙØ§"},{key:"NOTE",label:"ÛØ§Ø¯Ø¯Ø§Ø´ØªâÙØ§"},{key:"STATE_CHANGE",label:"تغÛÛØ± ÙØ¶Ø¹Ûت"},{key:"MESSAGE_SENT",label:"Ù¾ÛØ§Ù
âÙØ§"}];function h(e){let{reservationId:a,refreshKey:t}=e,[m,h]=(0,l.useState)(null),[b,j]=(0,l.useState)(""),[y,N]=(0,l.useState)(!1),[f,v]=(0,l.useState)(null),[C,A]=(0,l.useState)(""),{data:E,isLoading:w,mutate:S}=(0,n.u)(`/api/admin/activity?reservationId=${a}${C?`&kind=${C}`:""}&take=60&v=${t??0}`,e=>(0,r.SC)(e));async function D(){let e=b.trim();if(!(e.length<3)){N(!0),v(null);try{m?await (0,r.SC)("/api/admin/activity/calls",{method:"POST",body:JSON.stringify({direction:m.direction,party:m.party,summary:e,reservationId:a})}):await (0,r.SC)("/api/admin/activity/notes",{method:"POST",body:JSON.stringify({summary:e,reservationId:a})}),j(""),h(null),S()}catch(e){v(e instanceof Error?e.message:"ثبت ÙØ´Ø¯")}finally{N(!1)}}}let k=(null==E?void 0:E.items)??[],B=[];for(let e of k){let a=(0,i.A1)(e.created_at)[0],t=B[B.length-1];t&&t.day===a?t.rows.push(e):B.push({day:a,rows:[e]})}let F=(0,i.A1)(new Date)[0];return(0,s.jsxs)("div",{className:"flex flex-col gap-y-16",children:[(0,s.jsxs)(i.Zb,{className:"p-20",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-x-16 flex-wrap gap-y-10 mb-14",children:[(0,s.jsx)("h3",{className:"text-16 leading-24 font-m text-black",children:"تÙ
اس Ù ÛØ§Ø¯Ø¯Ø§Ø´Øª"}),(0,s.jsx)("div",{className:"flex items-center gap-x-8 flex-wrap gap-y-8",children:d.map(e=>{let a=(null==m?void 0:m.key)===e.key,t="OUTBOUND"===e.direction;return(0,s.jsxs)("button",{type:"button","aria-pressed":a,onClick:()=>h(a?null:e),className:`inline-flex items-center gap-x-6 px-12 py-8 rounded-10 text-13 leading-20 border transition ${a?t?o:x:"border-gray-E5E5E6 text-gray-6C6A7D hover:border-gray-C4CAD3"}`,children:[(0,s.jsx)(p,{outbound:t,small:!0}),e.label]},e.key)})})]}),(0,s.jsx)("textarea",{value:b,onChange:e=>j(e.target.value),rows:4,placeholder:m?`Ø´Ø±Ø ${m.label}`:"Ù
ØªÙ ÛØ§Ø¯Ø¯Ø§Ø´Øª",className:"w-full rounded-12 border border-gray-E5E5E6 p-14 text-14 leading-24 outline-none focus:border-primary-main resize-y"}),(0,s.jsxs)("div",{className:"flex items-center justify-between gap-x-12 flex-wrap gap-y-10 mt-12",children:[(0,s.jsx)("div",{className:"flex flex-wrap gap-8",children:c.map(e=>(0,s.jsx)("button",{type:"button",onClick:()=>{j(a=>a.trim()?`${a.trim()} ${e}`:e)},className:"px-12 py-6 rounded-10 border border-gray-E5E5E6 text-12 leading-20 text-gray-6C6A7D hover:border-gray-C4CAD3 hover:text-black transition",children:e},e))}),(0,s.jsx)(i.zx,{disabled:y||b.trim().length<3,onClick:D,children:y?"در ØØ§Ù ثبت...":m?"ثبت تÙ
اس":"ثبت ÛØ§Ø¯Ø¯Ø§Ø´Øª"})]}),(0,s.jsx)("p",{className:"mt-10 text-11 leading-18 text-gray-9B9BAA",children:m?`بÙâØ¹ÙÙØ§Ù \xab${m.label}\xbb با ÙØ§Ù
Ø´Ù
ا ثبت Ù
ÛâØ´ÙØ¯ ٠پاک ÙÙ
ÛâØ´ÙØ¯.`:"با ÙØ§Ù
Ø´Ù
ا در ØªØ§Ø±ÛØ®ÚÙâÛ Ø±Ø²Ø±Ù Ø«Ø¨Øª Ù
ÛâØ´ÙØ¯ ٠پاک ÙÙ
ÛâØ´ÙØ¯."}),f&&(0,s.jsx)("p",{className:"mt-8 text-13 text-[#C62828]",children:f})]}),(0,s.jsxs)(i.Zb,{className:"p-20",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-x-16 flex-wrap gap-y-10 mb-14",children:[(0,s.jsx)("h3",{className:"text-16 leading-24 font-m text-black",children:"تÙ
اسâÙØ§ ٠رÙÛØ¯Ø§Ø¯Ùا"}),(0,s.jsx)("div",{className:"flex items-center gap-x-6 flex-wrap gap-y-6",children:u.map(e=>
1(0,s.jsx)("button",{type:"button","aria-pressed":C===e.key,onClick:()=>A(e.key),className:`px-12 py-6 rounded-10 text-12 leading-20 border transition ${C===e.key?"border-primary-main bg-primary-light text-primary-dark font-m":"border-gray-E5E5E6 text-gray-6C6A7D hover:border-gray-C4CAD3"}`,children:e.label},e.key||"all"))})]}),w?(0,s.jsx)(i.Od,{className:"h-[200px]"}):0===k.length?(0,s.jsx)(i.ub,{text:"رÙÛØ¯Ø§Ø¯Û ثبت ÙØ´Ø¯Ù"}):(0,s.jsx)("div",{className:"flex flex-col gap-y-16",children:B.map(e=>(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-x-12 mb-10",children:[(0,s.jsx)("span",{className:"h-1 flex-1 bg-gray-F0F0F0"}),(0,s.jsx)("span",{className:"px-10 py-4 rounded-8 bg-primary-light text-primary-dark text-11 leading-18 whitespace-nowrap",children:e.day===F?`اÙ
Ø±ÙØ² ${e.day}`:e.day}),(0,s.jsx)("span",{className:"h-1 flex-1 bg-gray-F0F0F0"})]}),(0,s.jsx)("div",{className:"flex flex-col gap-y-10",children:e.rows.map(e=>(0,s.jsx)(g,{entry:e},e.id))})]},e.day))})]})]})}function g(e){var a,t,l;let{entry:n}=e,r=m[n.kind]??m.NOTE,d=(null===(a=n.call)||void 0===a?void 0:a.direction)==="OUTBOUND",c="CALL"===n.kind,u=c?d?o:x:r.chip;return(0,s.jsxs)("div",{className:"flex items-start gap-x-12",children:[(0,s.jsx)("span",{className:`w-36 h-36 rounded-12 border shrink-0 flex items-center justify-center ${u}`,children:c?(0,s.jsx)(p,{outbound:d}):(0,s.jsx)("i",{className:`${r.icon} text-15`})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-x-8 flex-wrap gap-y-4",children:[(0,s.jsx)("span",{className:`inline-flex items-center gap-x-4 px-8 py-2 rounded-8 border text-11 leading-18 ${u}`,children:c?(null===(t=n.call)||void 0===t?void 0:t.label)??"تÙ
اس":r.label}),(null===(l=n.call)||void 0===l?void 0:l.outcome)&&(0,s.jsx)("span",{className:"text-11 leading-18 text-gray-9B9BAA",children:n.call.outcome}),(0,s.jsx)("span",{className:"text-11 leading-18 text-gray-9B9BAA",children:n.actor_name??"Ø³ÛØ³ØªÙ
"}),(0,s.jsx)("span",{className:"text-11 leading-18 text-gray-9B9BAA mr-auto",children:(0,i.A1)(n.created_at)[1]})]}),(0,s.jsx)("p",{className:"text-13 leading-22 text-black break-words whitespace-pre-wrap mt-2",children:n.summary})]})]})}function p(e){let{outbound:a,small:t}=e;return(0,s.jsxs)("span",{className:`relative inline-flex ${t?"text-13":"text-15"}`,children:[(0,s.jsx)("i",{className:"icon-PhoneFill"}),(0,s.jsx)("span",{"aria-hidden":!0,className:`absolute -top-3 ${a?"-left-4":"-right-4"} text-9 leading-9 font-m`,children:a?"â":"â"})]})}},1965:function(e,a,t){"use strict";t.d(a,{Z:function(){return x}});var s=t(85893),l=t(67294),n=t(44389),r=t(84858),i=t(32474);let d=["DRAFT","HOST_APPROVAL","SECOND_PAYMENT","DONE"],c={DRAFT:"ثبت Ø¯Ø±Ø®ÙØ§Ø³Øª",HOST_APPROVAL:"تاÛÛØ¯ Ù
ÛØ²Ø¨Ø§Ù",SECOND_PAYMENT:"پرداخت Ù
ÙÙ
اÙ",DONE:"ÙØ·Ø¹Û",CANCEL:"ÙØºÙ",EXPIRED:"Ù
ÙÙØ¶Û"},o={DRAFT:"در Ø§ÙØªØ¸Ø§Ø± ثبت Ø¯Ø±Ø®ÙØ§Ø³Øª",HOST_APPROVAL:"در Ø§ÙØªØ¸Ø§Ø± تاÛÛØ¯ Ù
ÛØ²Ø¨Ø§Ù",SECOND_PAYMENT:"در Ø§ÙØªØ¸Ø§Ø± پرداخت Ù
ÙÙ
اÙ",DONE:"ÙØ·Ø¹Û",CANCEL:"ÙØºÙ شدÙ",EXPIRED:"Ù
ÙÙØ¶Û شدÙ"};function x(e){let{reservationId:a,createdAt:t,updatedAt:x,onCancel:m,onChanged:u}=e,{data:h,mutate:g}=(0,n.u)(`/api/admin/reservations/${a}/state`,e=>(0,r.SC)(e)),[p,b]=(0,l.useState)(null),[j,y]=(0,l.useState)(!1),[N,f]=(0,l.useState)(""),[v,C]=(0,l.useState)(!0),[A,E]=(0,l.useState)(!1),[w,S]=(0,l.useState)(null);if(!h)return(0,s.jsx)(i.Od,{className:"h-[92px]"});let D=d.indexOf(h.current),k="CANCEL"===h.current||"EXPIRED"===h.current,B=new Map(h.allowed.map(e=>[e.state,e.label]));async function F(){if(p){E(!0),S(null);try{await (0,r.SC)(`/api/admin/reservations/${a}/state`,{method:"POST",body:JSON.stringify({toState:p.state,note:N.trim(),notify:v})}),b(null),g(),u()}catch(e){S(e instanceof Error?e.message:"تغÛÛØ± ÙØ¶Ø¹Ûت Ø§ÙØ¬Ø§Ù
ÙØ´Ø¯")}finally{E(!1)}}}return(0,s.jsxs)(i.Zb,{className:"p-16",children:[(0,s.jsxs)("div",{className:"flex items-center gap-x-16 flex-wrap gap-y-12",children:[(0,s.jsx)("div",{className:"flex items-center gap-x-8 shrink-0",children:(0,s.jsx)(i.Ct,{tone:k?"red":"DONE"===h.current?"green":"yellow",children:h.current_label})}),(0,s.jsxs)("div",{className:`flex items-center gap-x-4 flex-1 min-w-[320px] ${k?"opacity-50":""}`,children:[d.map((e,a)=>{let t=e===h.current,l=B.has(e),n=!k&&a<D;return(0,s.jsxs)("div",{className:"flex items-center gap-x-4 flex-1 last:flex-initial",children:[(0,s.jsx)("button",{type:"button",disabled:!l,onClick:()=>(function(e,a){if("CANCEL"===e){m();return}b({state:e,label:a}),y(!1),f(""),C(!0),S(null)})(e,B.get(e)??o[e]),title:t?"ÙØ¶Ø¹Ûت ÙØ¹ÙÛ":l?`Ø§ÙØªÙا٠ب٠\xab${o[e]}\xbb`:"از ÙØ¶Ø¹Ûت ÙØ¹ÙÛ Ø§ÛÙ Ø§ÙØªÙا٠Ù
جاز ÙÛØ³Øª",className:`px-10 py-6 rounded-8 text-12 leading-18 whitespace-nowrap border transition ${t?"bg-primary-main text-white border-primary-main font-m":n?"bg-primary-light text-primary-dark border-primary-light":"bg-gray-F5F5F7 text-gray-9B9BAA border-gray-F5F5F7"}
1 ${l?"cursor-pointer hover:border-primary-main hover:text-primary-dark":"cursor-default"}`,children:c[e]}),a<d.length-1&&(0,s.jsx)("div",{className:`h-2 flex-1 rounded-full ${n?"bg-primary-main":"bg-gray-F0F0F0"}`})]},e)}),B.has("EXPIRED")||k?(0,s.jsx)("span",{className:`mr-10 px-10 py-6 rounded-8 text-12 leading-18 whitespace-nowrap border ${k?"bg-[#FFEBEB] text-[#C62828] border-[#FFEBEB] font-m":"bg-gray-F5F5F7 text-gray-9B9BAA border-gray-F5F5F7"}`,children:c["EXPIRED"===h.current?"EXPIRED":"CANCEL"]}):null]}),(0,s.jsxs)("span",{className:"text-11 leading-18 text-gray-9B9BAA whitespace-nowrap",children:["ثبت ",(0,i.IY)(t)," \xb7 آخرÛ٠تغÛÛØ± ",(0,i.IY)(x)]})]}),!k&&(0,s.jsx)("p",{className:"mt-10 text-11 leading-18 text-gray-9B9BAA",children:"Ø¨Ø±Ø§Û ØªØºÛÛØ± ÙØ¶Ø¹ÛØªØ Ø±ÙÛ Ù
رØÙÙâÛ Ù
ÙØµØ¯ Ú©ÙÛÚ© Ú©ÙÛØ¯. Ù
راØÙ ØºÛØ±Ùعا٠از ÙØ¶Ø¹Ûت ÙØ¹ÙÛ Ù
جاز ÙÛØ³ØªÙد."}),(0,s.jsx)(i.u_,{open:!!p,onClose:()=>b(null),title:j?"ØªÙØ¶ÛØ ØªØºÛÛØ± ÙØ¶Ø¹Ûت":"Ø¢ÛØ§ Ù
Ø·Ù
Ø¦Ù ÙØ³ØªÛدØ",width:"max-w-[520px]",children:j?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("textarea",{value:N,onChange:e=>f(e.target.value),rows:3,placeholder:"ÚØ±Ø§ اÛ٠رزر٠جابÙâØ¬Ø§ Ù
ÛâØ´ÙØ¯Ø",className:"w-full rounded-10 border border-gray-E5E5E6 p-12 text-13 leading-22 outline-none focus:border-primary-main"}),(0,s.jsx)("p",{className:"mt-6 text-11 leading-18 text-gray-9B9BAA",children:"اÛÙ ØªÙØ¶ÛØ Ø¯Ø± ØªØ§Ø±ÛØ®ÚÙâÛ Ø±Ø²Ø±Ù Ø¨Ø§ ÙØ§Ù
Ø´Ù
ا ثبت Ù
ÛâØ´ÙØ¯ ٠پاک ÙÙ
ÛâØ´ÙØ¯."}),(0,s.jsxs)("label",{className:"flex items-start gap-x-10 mt-14 cursor-pointer",children:[(0,s.jsx)("input",{type:"checkbox",checked:v,onChange:e=>C(e.target.checked),className:"w-16 h-16 mt-2 accent-[#03D6BB]"}),(0,s.jsxs)("span",{children:[(0,s.jsx)("span",{className:"block text-13 leading-22 text-black",children:"Ø§Ø·ÙØ§Ø¹âرساÙÛ Ø¨Ù Ù
ÙÙ
ا٠٠Ù
ÛØ²Ø¨Ø§Ù"}),(0,s.jsx)("span",{className:"block text-11 leading-18 text-gray-9B9BAA",children:"Ø§Ø¹ÙØ§Ù درÙÙâØ³Ø§ÛØªÛ ارسا٠Ù
ÛâØ´ÙØ¯. سرÙÛØ³ Ù¾ÛØ§Ù
Ú© ÙÙÙØ² ÙØµÙ ÙÛØ³ØªØ پس ÙØ¹ÙØ§Ù Ù¾ÛØ§Ù
Ú©Û ÙØ±Ø³ØªØ§Ø¯Ù ÙÙ
ÛâØ´ÙØ¯."})]})]}),w&&(0,s.jsx)("p",{className:"mt-10 text-13 text-[#C62828]",children:w}),(0,s.jsxs)("div",{className:"flex justify-end gap-x-8 mt-16",children:[(0,s.jsx)(i.zx,{variant:"secondary",onClick:()=>y(!1),children:"بازگشت"}),(0,s.jsx)(i.zx,{disabled:A||N.trim().length<3,onClick:F,children:A?"در ØØ§Ù ثبت...":"ثبت تغÛÛØ± ÙØ¶Ø¹Ûت"})]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("p",{className:"text-14 leading-24 text-black",children:["ÙØ¶Ø¹Ûت اÛ٠رزر٠از \xab",h.current_label,"\xbb ب٠\xab",p&&o[p.state],"\xbb تغÛÛØ± Ù
ÛâÚ©ÙØ¯."]}),(0,s.jsx)("p",{className:"mt-8 text-12 leading-20 text-gray-6C6A7D",children:(null==p?void 0:p.state)==="DONE"?"با اÛ٠کار سÙÙ
Ù
ÛØ²Ø¨Ø§Ù در Ú©ÛÙ Ù¾ÙÙØ´ ثبت Ù
ÛâØ´ÙØ¯.":(null==p?void 0:p.state)==="DRAFT"||(null==p?void 0:p.state)==="EXPIRED"?"با اÛ٠کار شبâÙØ§Û اÛ٠رزر٠در تÙÙÛÙ
آزاد Ù
ÛâØ´ÙÙØ¯.":"Ù
ÙÙØª اÛÙ Ù
رØÙ٠از ØªÙØ¸ÛÙ
ات Ø±Ø²Ø±ÙØ§Ø³ÛÙÙ Ø¯ÙØ¨Ø§Ø±Ù ØªÙØ¸ÛÙ
Ù
ÛâØ´ÙØ¯."}),(0,s.jsxs)("div",{className:"flex justify-end gap-x-8 mt-16",children:[(0,s.jsx)(i.zx,{variant:"secondary",onClick:()=>b(null),children:"Ø§ÙØµØ±Ø§Ù"}),(0,s.jsx)(i.zx,{onClick:()=>y(!0),children:"بÙÙØ اداÙ
Ù"})]})]})})]})}},98209:function(e,a,t){"use strict";t.r(a),t.d(a,{default:function(){return en}});var s=t(85893),l=t(67294),n=t(41664),r=t.n(n),i=t(11163),d=t(44389),c=t(49759),o=t(84858),x=t(35157),m=t(32474);let u=[{value:"GUEST_CANCELLED",label:"Ù
ÙÙ
اÙ"},{value:"HOST_CANCELLED",label:"Ù
ÛØ²Ø¨Ø§Ù"},{value:"LIDOMA_CANCELLED",label:"ÙÛØ¯ÙÙ
ا (Ø³Ø§ÛØª)"}],h=[{value:"BOTH",label:"ÙØ± دÙ",hint:"Ù
ÙÙ
ا٠٠Ù
ÛØ²Ø¨Ø§Ù ÙØ± د٠خبر Ù
ÛâØ´ÙÙØ¯"},{value:"ONLY_GUEST",label:"ÙÙØ· Ù
ÙÙ
اÙ",hint:"Ù
ÛØ²Ø¨Ø§Ù Ù¾ÛØ§Ù
Û Ø¯Ø±ÛØ§Ùت ÙÙ
ÛâÚ©ÙØ¯"},{value:"ONLY_HOST",label:"ÙÙØ· Ù
ÛØ²Ø¨Ø§Ù",hint:"Ù
ÙÙ
Ø§Ù Ù¾ÛØ§Ù
Û Ø¯Ø±ÛØ§Ùت ÙÙ
ÛâÚ©ÙØ¯"},{value:"NONE",label:"ÙÛÚâکداÙ
",hint:"ÙØ¨Ùا٠تÙÙÙÛ ÙÙ
اÙÙÚ¯ شدÙ"}],g={GUEST_CANCELLED:["از Ø§ÙØ¬Ø§Ù
Ø³ÙØ± Ù
ÙØµØ±Ù شدÙ
","تأÛÛØ¯ Ù
ÛØ²Ø¨Ø§Ù Ø®ÛÙÛ Ø·ÙÙ Ú©Ø´ÛØ¯","در ثبت Ø§Ø·ÙØ§Ø¹Ø§Øª Ø¯ÚØ§Ø± اشتبا٠شدÙâØ§Ù
","Ø§ÙØ§Ù
تگا٠دÛÚ¯Ø±Û Ø¯Ø± ÙÛØ¯ÙÙ
ا Ù¾ÛØ¯Ø§ کردÙ
","با ÙÛÙ
ت تÙ
اÙ
âØ´Ø¯Ù Ø±Ø²Ø±Ù Ù
شک٠داشتÙ
","در پرداخت Ù
شک٠داشتÙ
"],HOST_CANCELLED:["Ø§ÙØ§Ù
تگا٠آÙ
اد٠ÙÛØ³Øª","ÙØ¨ÙØ§Ù Ø±Ø²Ø±Ù Ø´Ø¯Ù Ø¨ÙØ¯","Ù
Ø³Ø§ÙØ± Ø¯ÛØ± پرداخت کرد","Ù
Ø´Ú©Ù ÙÙÛ Ø¯Ø± Ø§ÙØ§Ù
تگاÙ"],LIDOMA_CANCELLED:["ÙÙ
اÙÙÚ¯Û Ø¨Ø§ Ù
ÛØ²Ø¨Ø§Ù","ÙÙ
اÙÙÚ¯Û Ø¨Ø§ Ù
ÙÙ
اÙ","تخÙÙ Ù
ÛØ²Ø¨Ø§Ù","تخÙÙ Ù
ÙÙ
اÙ","عدÙ
پاسخگÙÛÛ Ù
ÛØ²Ø¨Ø§Ù"]};function p(e){let{reservationId:a,reference:t,open:n,onClose:r,onCancelled:i}=e,[c,x]=(0,l.useState)("LIDOMA_CANCELLED"),[p,j]=(0,l.useState)(""),[y,N]=(0,l.useState)(""),[f,v]=(0,l.useState)(!1),[C,A]=(0,l.useState)(!1),[E,w]=(0,l.useState)(""),[S,D]=(0,l.useState)("BOTH"),[k,B]=(0,l.useState)(""),[F,_]=(0,l.useState)(!1),[$,O]=(0,l.useState)(null);(0,l.useEffect)(()=>{j("")},[c]);let T=k.trim()?(0,m.EU)(k):null,P=new URLSearchParams({cancelledBy:c,...f?{justified:"true"}:{},...C?{withoutPayback:"true"}:{},...null!=T?{penaltyOverride:String(T)}:{}}),{data:M}=(0,d.u)(n?`/api/admin/reservations/${a}/cancel-quote?${P.toString()}`:null,e=>(0,o.SC)(e));async function I(){_(!0),O(null);try{await (0,o.SC)(`/api/admin/reservations/${a}/cancel`,{method:"POST",body:JSON.stringify({cancelledBy:c,reason:p.trim(),desc:y.trim()||null,justified:f,withoutPayback:C,coordinatedWith:E||null,
1notifyMode:S,penaltyOverride:T})}),i(),r()}catch(e){O(e instanceof Error?e.message:"ÙØºÙ Ø§ÙØ¬Ø§Ù
ÙØ´Ø¯")}finally{_(!1)}}return(0,s.jsxs)(m.u_,{open:n,onClose:r,title:`ÙØºÙ رزر٠${t}`,width:"max-w-[860px]",children:[(0,s.jsxs)("div",{className:"grid gap-16 md:grid-cols-[1fr_300px] items-start",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-y-14",children:[(0,s.jsx)(m.gN,{label:"ÙØºÙ ØªÙØ³Ø·",children:(0,s.jsx)(m.Ph,{value:c,onChange:e=>x(e.target.value),children:u.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label},e.value))})}),(0,s.jsx)(m.gN,{label:"Ø¹ÙØª ÙØºÙ",children:(0,s.jsxs)(m.Ph,{value:p,onChange:e=>j(e.target.value),children:[(0,s.jsx)("option",{value:"",children:"Ø§ÙØªØ®Ø§Ø¨ Ú©ÙÛØ¯â¦"}),g[c].map(e=>(0,s.jsx)("option",{value:e,children:e},e)),(0,s.jsx)("option",{value:"Ø³Ø§ÛØ± Ù
ÙØ§Ø±Ø¯",children:"Ø³Ø§ÛØ± Ù
ÙØ§Ø±Ø¯"})]})}),(0,s.jsx)(m.gN,{label:"ØªÙØ¶ÛØ Ø¯Ø§Ø®ÙÛ (ÙÙØ· Ø¨Ø±Ø§Û ØªÛÙ
Ù¾Ø´ØªÛØ¨Ø§ÙÛ)",children:(0,s.jsx)(m.II,{value:y,onChange:e=>N(e.target.value)})}),"LIDOMA_CANCELLED"===c&&(0,s.jsx)(m.gN,{label:"با ÙÙ
اÙÙÚ¯Û",children:(0,s.jsxs)(m.Ph,{value:E,onChange:e=>w(e.target.value),children:[(0,s.jsx)("option",{value:"",children:"â"}),(0,s.jsx)("option",{value:"guest",children:"Ù
ÙÙ
اÙ"}),(0,s.jsx)("option",{value:"host",children:"Ù
ÛØ²Ø¨Ø§Ù"})]})}),(0,s.jsxs)("div",{className:"rounded-10 bg-gray-F5F5F7 p-12 flex flex-col gap-y-10",children:[(0,s.jsxs)("label",{className:"flex items-start gap-x-10 cursor-pointer",children:[(0,s.jsx)(m.ZD,{checked:f,onChange:v}),(0,s.jsxs)("span",{children:[(0,s.jsx)("span",{className:"block text-14 leading-20 text-black",children:"Ú©ÙØ³ÙÛ Ù
ÙØ¬Ù"}),(0,s.jsx)("span",{className:"block text-11 leading-18 text-gray-9B9BAA",children:"Ú©Ø³Ø±Û Ø§Ø¹Ù
ا٠ÙÙ
ÛâØ´ÙØ¯ Ù Ú©Ù Ù
Ø¨ÙØº Ù¾Ø±Ø¯Ø§Ø®ØªÛ Ø¨Ù Ù
ÙÙ
ا٠برÙ
Ûâگردد."})]})]}),(0,s.jsxs)("label",{className:"flex items-start gap-x-10 cursor-pointer",children:[(0,s.jsx)(m.ZD,{checked:C,onChange:A}),(0,s.jsxs)("span",{children:[(0,s.jsx)("span",{className:"block text-14 leading-20 text-black",children:"عدÙ
بازگشت ÙØ¬Ù ب٠Ù
شترÛ"}),(0,s.jsx)("span",{className:"block text-11 leading-18 text-gray-9B9BAA",children:"ÙÛÚ Ù
Ø¨ÙØºÛ ب٠Ù
ÙÙ
ا٠برÙÙ
Ûâگردد. تصÙ
ÛÙ
Ø§Ø³ØªØ ÙÙ Ù
ØØ§Ø³Ø¨Ù."})]})]})]}),(0,s.jsxs)(m.gN,{label:"Ù
Ø¨ÙØº کسر Ø¯Ø³ØªÛ (Ø§Ø®ØªÛØ§Ø±Û â ØªÙÙ
اÙ)",children:[(0,s.jsx)(m.II,{inputMode:"numeric",value:T?T.toLocaleString("fa-IR"):"",onChange:e=>B(e.target.value),placeholder:"طب٠Ù
ÙØ±Ø±Ø§Øª Ù
ØØ§Ø³Ø¨Ù Ù
ÛâØ´ÙØ¯"}),(0,s.jsx)("p",{className:"mt-6 text-11 leading-18 text-gray-9B9BAA",children:"Ø¨Ø±Ø§Û Ø±Ø²Ø±ÙÙØ§Û بÙÙØ¯Ù
دت Ù Ø§ÛØ§Ù
Ù¾ÛÚ© ک٠طب٠Ù
ÙØ±Ø±Ø§Øª \xabبا ØªÙØ§ÙÙ Ù
ÛØ²Ø¨Ø§Ù\xbb تعÛÛÙ Ù
ÛâØ´ÙÙØ¯."})]}),(0,s.jsx)(m.gN,{label:"ÙØÙÙ Ø§Ø±Ø³Ø§Ù Ù¾ÛØ§Ù
ÙØºÙ",children:(0,s.jsx)("div",{className:"grid grid-cols-2 gap-8",children:h.map(e=>(0,s.jsxs)("button",{type:"button",onClick:()=>D(e.value),"aria-pressed":S===e.value,className:`text-right px-12 py-10 rounded-10 border transition ${S===e.value?"border-primary-main bg-primary-light":"border-gray-E5E5E6 hover:border-gray-C4CAD3"}`,children:[(0,s.jsx)("span",{className:"block text-13 leading-20 text-black",children:e.label}),(0,s.jsx)("span",{className:"block text-11 leading-16 text-gray-9B9BAA",children:e.hint})]},e.value))})})]}),(0,s.jsxs)("div",{className:"rounded-12 border border-gray-E5E5E6 p-14 sticky top-0",children:[(0,s.jsx)("h4",{className:"text-14 leading-22 font-m text-black mb-2",children:"ØµÙØ±ØªØØ³Ø§Ø¨ ÙØºÙ"}),M?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(m.Ct,{tone:M.penalty>0?"yellow":"green",children:M.bandLabel}),(0,s.jsxs)("div",{className:"mt-12 flex flex-col gap-y-6 text-12 leading-20",children:[(0,s.jsx)(b,{label:"Ù
Ø¨ÙØº ک٠اجارÙ",value:M.totalAmount}),(0,s.jsx)(b,{label:"Ù¾Ø±Ø¯Ø§Ø®ØªÛ Ù
ÙÙ
اÙ",value:M.paidAmount}),(0,s.jsx)("div",{className:"border-t border-dashed border-gray-E5E5E6 my-4"}),(0,s.jsx)(b,{label:"کسر",value:M.penalty,tone:"red"}),(0,s.jsx)(b,{label:"بازگشت ب٠Ù
ÙÙ
اÙ",value:M.refund,tone:"green",strong:!0}),(0,s.jsx)("div",{className:"border-t border-dashed border-gray-E5E5E6 my-4"}),(0,s.jsx)(b,{label:"سÙÙ
Ù
ÛØ²Ø¨Ø§Ù از کسر",value:M.hostShare}),(0,s.jsx)(b,{label:"سÙÙ
Ø³Ø§ÛØª از کسر",value:M.siteShare})]}),(0,s.jsx)("ul",{className:"mt-12 flex flex-col gap-y-4",children:M.explanation.map((e,a)=>(0,s.jsxs)("li",{className:"text-11 leading-18 text-gray-6C6A7D",children:["\xb7 ",e]},a))}),(0,s.jsx)("p",{className:"mt-10 text-11 leading-18 text-gray-9B9BAA",children:M.hoursToCheckIn>0?`${(0,m.N)(M.hoursToCheckIn)} ساعت تا Ø´Ø±ÙØ¹ Ø§ÙØ§Ù
ت`:"Ø§ÙØ§Ù
ت Ø´Ø±ÙØ¹ شد٠است"})]}):(0,s.jsx)("p",{className:"text-12 text-gray-9B9BAA",children:"در ØØ§Ù Ù
ØØ§Ø³Ø¨Ùâ¦"})]})]}),!!$&&(0,s.jsx)("p",{className:"mt-12 text-13 text-[#C62828]",children:$}),(0,s.jsxs)("div",{className:"flex justify-end gap-x-10 mt-16",children:[(0,s.jsx)(m.zx,{variant:"secondary",onClick:r,children:"Ø§ÙØµØ±Ø§Ù"}),(0,s.jsx)(m.zx,{variant:"danger",disabled:F||!p.trim(),onClick:I,children:F?"در ØØ§Ù ÙØºÙ...":"ÙØºÙ رزرÙ"})]})]})}function b(e){let{label:a,value:t,tone:l,strong:n}=e;return(0,s.jsxs)("div",{className:"flex items-baseline justify-between gap-x-10",children:[(0,s.jsx)("span",{className:"text-gray-6C6A7D",children:a}),(0,s.jsx)("span",{className:`whitespace-nowrap ${n?"font-m":""} ${"red"===l?"text-[#C62828]":"green"===l?"text-[#2E7D32]":"text-black"}`,children:(0,m.N)(t)})]})}var j=t(1965);let y=[{kind:"HOST_INFO_TO_GUEST",label:"Ø§Ø·ÙØ§Ø¹Ø§Øª Ù
ÛØ²Ø¨Ø§Ù ب٠Ù
ÙÙ
اÙ"},{kind:"GUEST_INFO_TO_HOST",label:"Ø§Ø·ÙØ§Ø¹Ø§Øª Ù
ÙÙ
ا٠ب٠Ù
ÛØ²Ø¨Ø§Ù"},{kind:"RESIDENCE_LINK_TO_GUEST",label:"ÙÛÙÚ© Ø§ÙØ§Ù
تگاÙ"},{kind:"VOUCHER_TO_HOST",label:"ÙÚØ± ب٠Ù
ÛØ²Ø¨Ø§Ù"},{kind:"PAYMENT_LINK_TO_GUEST",label:"ÙÛÙÚ© پرداخت"},{kind:"CARD_NUMBER_TO_GUEST",label:"Ø´Ù
ار٠کارت"},{kind:"REVIEW_LINK_TO_GUEST",label:"ÙÛÙÚ© ÙØ¸Ø±Ø³ÙجÛ"}];function N(e){let{reservationId:a,onActed:t}=e,[n,r]=(0,l.useState)(!1),[i,d]=(0,l.useState)(null),[c,x]=(0,l.useState)(null),[u,h]=(0,l.useState)(null),g=(0,l.useRef)(null);async function p(e,s){d(e),h(null),x(null);try{var l;let n=await (0,o.SC)(`/api/admin/reservations/${a}/actions`,{method:"POST",body:JSON.stringify({kind:e})});x(`${s} ارسا٠شد â ${(null==n?void 0:null===(l=n.sms)||void 0===l?void 0:l.sent)?"Ù¾ÛØ§Ù
Ú© Ù Ø§Ø¹ÙØ§Ù":"ÙÙØ· Ø§Ø¹ÙØ§Ù Ø¯Ø§Ø®Ù Ø³Ø§ÛØª"}`),r(!1),t(),setTimeout(()=>x(null),4e3)}catch(e){h(e instanceof Error?e.message:"Ø§Ø±Ø³Ø§Ù ÙØ´Ø¯")}finally{d(null)}}return(0,l.useEffect)(()=>
1{if(n)return document.addEventListener("mousedown",e),document.addEventListener("keydown",a),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",a)};function e(e){var a;(null===(a=g.current)||void 0===a?void 0:a.contains(e.target))||r(!1)}function a(e){"Escape"===e.key&&r(!1)}},[n]),(0,s.jsxs)("div",{ref:g,className:"relative",children:[(0,s.jsxs)(m.zx,{variant:"secondary",onClick:()=>r(e=>!e),"aria-expanded":n,children:[(0,s.jsx)("i",{className:"icon-SendMessage text-16"})," Ø§Ø±Ø³Ø§Ù Ù¾ÛØ§Ù
",(0,s.jsx)("i",{className:`icon-FlashDown text-14 transition ${n?"rotate-180":""}`})]}),n&&(0,s.jsxs)("div",{className:"absolute z-3 mt-6 left-0 w-[248px] bg-white rounded-12 border border-gray-E5E5E6 shadow-[0_6px_16px_0px_rgba(8,19,56,0.12)] p-6",children:[(0,s.jsx)("p",{className:"px-10 py-6 text-11 leading-18 text-gray-9B9BAA",children:"ÙØ± ارسا٠در ØªØ§Ø±ÛØ®Ú٠ثبت Ù
ÛâØ´ÙØ¯"}),y.map(e=>(0,s.jsx)("button",{type:"button",disabled:i===e.kind,onClick:()=>p(e.kind,e.label),className:"w-full text-right px-10 py-8 rounded-10 text-13 leading-20 text-gray-6C6A7D hover:bg-gray-F7F7F7 hover:text-black transition disabled:opacity-50",children:i===e.kind?"در ØØ§Ù ارساÙ...":e.label},e.kind)),u&&(0,s.jsx)("p",{className:"px-10 py-6 text-12 text-[#C62828]",children:u})]}),c&&(0,s.jsx)("span",{className:"absolute top-full right-0 mt-6 whitespace-nowrap rounded-8 bg-[#03D6BB14] text-[#015046] text-12 leading-20 px-10 py-4",children:c})]})}var f=t(7092),v=t(68289),C=t.n(v);let A=["ÙØ±ÙردÛÙ","Ø§Ø±Ø¯ÛØ¨Ùشت","خرداد","ØªÛØ±","Ù
رداد","Ø´ÙØ±ÛÙØ±","Ù
ÙØ±","آباÙ","آذر","دÛ","بÙÙ
Ù","اسÙÙØ¯"],E=e=>String(e).replace(/[0-9]/g,e=>"Û°Û±Û²Û³Û´ÛµÛ¶Û·Û¸Û¹"[Number(e)]);function w(e){let{open:a,onClose:t,reservationId:n,reference:r,residenceId:i,startDate:c,endDate:x,onSaved:u}=e,[h,g]=(0,l.useState)({}),[p,b]=(0,l.useState)(new Set),[j,y]=(0,l.useState)(0),[N,f]=(0,l.useState)(""),[v,w]=(0,l.useState)("both"),[F,_]=(0,l.useState)(""),[$,O]=(0,l.useState)(!1),[T,P]=(0,l.useState)(null),M=c.slice(0,10),I=x.slice(0,10);(0,l.useEffect)(()=>{if(!a)return;let e=C()(M,"YYYY-MM-DD").diff(C()().startOf("jMonth"),"months");y(e),g({}),b(new Set),_(""),P(null),w("both")},[a,M]);let L=JSON.stringify(h),{data:R}=(0,d.u)(a?`/api/admin/reservations/${n}/reprice`:null,e=>(0,o.SC)(e)),{data:G,isLoading:z}=(0,d.u)(a?[`/api/admin/reservations/${n}/reprice/preview`,L]:null,e=>{let[a,t]=e;return(0,o.SC)(a,{method:"POST",body:JSON.stringify({draft:JSON.parse(t)})})},{keepPreviousData:!0}),U=(0,l.useMemo)(()=>C()().add(j,"jMonth"),[j]),Y=U.clone().startOf("jMonth").format("YYYY-MM-DD"),H=U.clone().endOf("jMonth").format("YYYY-MM-DD"),{data:Z}=(0,d.u)(a?`/api/admin/residences/${i}/calendar?from=${Y}&to=${H}`:null,e=>(0,o.SC)(e)),J=(null==Z?void 0:Z.days)??[],X=(U.clone().startOf("jMonth").day()+1)%7,V=Object.entries(h).sort((e,a)=>{let[t]=e,[s]=a;return t.localeCompare(s)}),W=V.length>0,K=e=>{var a,t;return(null===(a=null==R?void 0:R.nights.find(a=>a.date===e))||void 0===a?void 0:a.unitPrice)??(null===(t=J.find(a=>a.date===e))||void 0===t?void 0:t.effective_price)??0};async function q(){if(W&&!(F.trim().length<3)){O(!0),P(null);try{if("calendar"===v||"both"===v){let e=new Map;for(let[a,t]of V)e.set(t,[...e.get(t)??[],a]);for(let[a,t]of e)await (0,o.SC)(`/api/admin/residences/${i}/calendar`,{method:"PATCH",body:JSON.stringify({dates:t,specialPrice:a})})}("reservation"===v||"both"===v)&&await (0,o.SC)(`/api/admin/reservations/${n}/reprice`,{method:"POST",body:JSON.stringify({note:F.trim(),..."reservation"===v?{draft:h}:{}})}),u(),t()}catch(e){P(e instanceof Error?e.message:"Ø°Ø®ÛØ±Ù ÙØ´Ø¯")}finally{O(!1)}}}let Q=(0,m.EU)(N);return(0,s.jsx)(m.u_,{open:a,onClose:t,title:`ÙÛØ±Ø§ÛØ´ ÙÛÙ
ت رزر٠${r}`,width:"max-w-[1180px]",children:z&&!G?(0,s.jsx)(m.Od,{className:"h-[420px]"}):G?(0,s.jsxs)("div",{className:"grid lg:grid-cols-14 gap-16 items-start",children:[(0,s.jsxs)("section",{className:"lg:col-span-4 rounded-16 border border-gray-E5E5E6 p-16 min-w-0",children:[(0,s.jsx)("h4",{className:"text-14 leading-22 font-m text-black mb-2",children:"ÙØ±Ø®âÙØ§Û Ù
ØØ§Ø³Ø¨ÙâØ´Ø¯Ù"}),(0,s.jsx)("p",{className:"text-11 leading-18 text-gray-9B9BAA mb-12",children:"ÙÙ
ا٠ÚÛØ²Û Ú©Ù Ù
ÙÙ
ا٠در ÙØ±Ù
Ø±Ø²Ø±Ù Ø¯ÛØ¯. تغÛÛØ± ÙØ± ÙØ±Ø® رÙÛ ÙÙ
ÙâÛ Ø´Ø¨âÙØ§Û Ø¢Ù ÙÙØ¹ اعÙ
ا٠Ù
ÛâØ´ÙØ¯."}),(0,s.jsx)("div",{className:"flex flex-col gap-y-10",children:((null==R?void 0:R.buckets)??G.buckets).map(e=>(0,s.jsx)(D,{bucket:e,draftPrice:function(e,a,t){let s=new Set;for(let l of a)S(l,e)&&s.add(t[l.date]??l.unitPrice);return 0===s.size?e.unit_price:s.size>1?null:[...s][0]}(e,(null==R?void 0:R.nights)??[],h),onChange:a=>(function(e,a){if(!R)return;let t={...h};for(let s of R.nights)S(s,e)&&(t[s.date]=a);g(t)})(e,a),editable:!!R&&"extra-guests"!==e.key},e.key))}),G.totals.discount_amount>0&&(0,s.jsxs)("div",{className:"flex items-center justify-between mt-12 text-12 leading-20",children:[(0,s.jsxs)("span",{className:"text-gray-6C6A7D",children:["تخÙÛÙ Ø§ÙØ§Ù
ت بÙÙØ¯Ù
دت \xb7 ",(0,m.N)(G.totals.discount_percent),"Ùª"]}),(0,s.jsxs)("span",{className:"text-[#C62828]",children:["â ",(0,m.N)(G.totals.discount_amount)]})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between gap-x-12 mt-12 rounded-10 bg-gray-F5F5F7 px-12 py-10",children:[(0,s.jsx)("span",{className:"text-12 leading-20 text-gray-6C6A7D",children:"Ù
Ø¨ÙØº رزرÙ"}),(0,s.jsx)("b",{className:"text-14 leading-24 font-m text-black",children:(0,m.ND)(G.totals.reservation_amount)})]}),(0,s.jsx)("p",{className:"mt-10 text-11 leading-18 text-gray-9B9BAA",children:"ÙØ±Ø® ÙÙØ± اضاÙ٠از ØªÙØ¸ÛÙ
ات Ø®ÙØ¯ Ø§ÙØ§Ù
تگا٠Ù
ÛâØ¢ÛØ¯ ٠از اÛÙØ¬Ø§ تغÛÛØ± ÙÙ
ÛâÚ©ÙØ¯."})]}),(0,s.jsxs)("section",{className:"lg:col-span-6 rounded-16 border border-gray-E5E5E6 p-16 min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-x-10 mb-12",children:[(0,s.jsx)(m.zx,{variant:"secondary",onClick:()=>y(e=>e-1),children:"Ù
Ø§Ù ÙØ¨Ù"}),(0,s.jsxs)("span",{className:"text-14 font-m text-black",children:[A[U.jMonth()]," ",E(U.jYear())]}),(0,s.jsx)(m.zx,{variant:"secondary",onClick:()=>y(e=>e+1),children:"Ù
ا٠بعد"})]}),(0,s.jsx)("div",{className:"grid grid-cols-7 gap-4 mb-4",children:["Ø´","Û","د","س","Ú","Ù¾","ج"].map(e=>(0,s.jsx)("div",{className:"text-center text-11 text-gray-9B9BAA py-2",children:e},e))}),(0,s.jsxs)("div",{className:"grid grid-cols-7 gap-4",children:[Array.from({length:X}).map((e,a)=>(0,s.jsx)("div",{},`blank-${a}`)),J.map(e=>{var a,t;let l=e.date>=M&&e.date<I,n=p.has(e.date),r=void 0!==h[e.date],i=r?h[e.date]:e.effective_price;return(0,s.jsxs)("button",{type:"button",onClick:()=>b(a=>
1{let t=new Set(a);return t.has(e.date)?t.delete(e.date):t.add(e.date),t}),title:l?"شب اÛ٠رزرÙ":(null===(a=e.reservation)||void 0===a?void 0:a.reference)??"",className:`relative rounded-10 border p-6 text-right transition min-h-[58px] ${n?"border-primary-main bg-primary-light":r?"border-[#B26A00] bg-[#FFF4E0]":"border-gray-E5E5E6 bg-white hover:border-gray-C4CAD3"} ${l?"ring-2 ring-primary-main ring-offset-1":""}`,children:[(0,s.jsx)("span",{className:"block text-12 leading-18 text-black",children:(t=e.date,E(C()(t,"YYYY-MM-DD").format("jD")))}),(0,s.jsxs)("span",{className:`block text-10 leading-14 ${r?"text-[#B26A00] font-m":"text-gray-6C6A7D"}`,children:[(0,m.N)(Math.round(i/1e3)),"k"]}),e.reservation&&!l&&(0,s.jsx)("span",{className:"absolute top-4 left-4 w-6 h-6 rounded-full bg-gray-C4CAD3"})]},e.date)})]}),(0,s.jsxs)("div",{className:"flex items-center gap-x-8 flex-wrap gap-y-8 mt-12",children:[(0,s.jsx)("span",{className:"text-12 leading-20 text-gray-6C6A7D",children:p.size>0?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("b",{children:(0,m.N)(p.size)})," Ø±ÙØ² Ø§ÙØªØ®Ø§Ø¨ شدÙ"]}):"Ø±ÙØ²Ùا را Ø§ÙØªØ®Ø§Ø¨ Ú©ÙÛØ¯"}),(0,s.jsx)(m.zx,{variant:"secondary",onClick:()=>b(new Set(J.filter(e=>e.date>=M&&e.date<I).map(e=>e.date))),children:"شبâÙØ§Û اÛ٠رزرÙ"}),p.size>0&&(0,s.jsx)(m.zx,{variant:"secondary",onClick:()=>b(new Set),children:"پاک کردÙ"})]}),(0,s.jsxs)("div",{className:"flex items-end gap-x-8 mt-10",children:[(0,s.jsxs)("label",{className:"flex-1 min-w-0",children:[(0,s.jsx)("span",{className:"block mb-4 text-11 leading-18 text-gray-6C6A7D",children:"ÙØ±Ø® Ø±ÙØ²ÙØ§Û Ø§ÙØªØ®Ø§Ø¨âشد٠(تÙÙ
اÙ)"}),(0,s.jsx)("input",{inputMode:"numeric",value:Q?Q.toLocaleString("fa-IR"):"",onChange:e=>f(e.target.value),placeholder:"Ù
Ø«ÙØ§Ù ÛµÙ¬Û°Û°Û°Ù¬Û°Û°Û°",className:"w-full px-12 py-8 rounded-10 border border-gray-E5E5E6 text-13 leading-22 outline-none focus:border-primary-main"})]}),(0,s.jsx)(m.zx,{disabled:0===p.size||Q<=0,onClick:function(){let e=(0,m.EU)(N);if(!e||0===p.size)return;let a={...h};p.forEach(t=>a[t]=e),g(a),b(new Set),f("")},children:"اعÙ
اÙ"})]}),(0,s.jsx)("p",{className:"mt-8 text-11 leading-18 text-gray-9B9BAA",children:"ØÙÙÙâÛ Ø±ÙÚ¯Û = شبâÙØ§Û اÛ٠رزر٠\xb7 زرد = تغÛÛØ± Ø°Ø®ÛØ±ÙâÙØ´Ø¯Ù"})]}),(0,s.jsxs)("section",{className:"lg:col-span-4 rounded-16 border border-gray-E5E5E6 p-16 min-w-0 flex flex-col",children:[(0,s.jsx)("h4",{className:"text-14 leading-22 font-m text-black mb-2",children:"تغÛÛØ±Ø§Øª"}),W?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"max-h-[132px] overflow-y-auto rounded-10 border border-gray-F0F0F0 divide-y divide-gray-F0F0F0 mb-12",children:V.map(e=>{let[a,t]=e,l=K(a);return(0,s.jsxs)("div",{className:"flex items-center justify-between px-10 py-6 text-12 leading-20",children:[(0,s.jsx)("span",{className:"text-gray-6C6A7D",children:function(e){let a=C()(e,"YYYY-MM-DD");return`${E(a.format("jD"))} ${A[a.jMonth()]}`}(a)}),(0,s.jsxs)("span",{className:"text-black whitespace-nowrap",children:[(0,s.jsx)("span",{className:"text-gray-9B9BAA line-through",children:(0,m.N)(l)})," â ",(0,s.jsx)("b",{className:"font-m",children:(0,m.N)(t)})]})]},a)})}),(0,s.jsxs)("div",{className:"rounded-10 bg-gray-F5F5F7 p-12 mb-12",children:[(0,s.jsx)(k,{label:"Ù
Ø¨ÙØº ک٠اجارÙ",a:G.before.total_amount,b:G.after.total_amount}),(0,s.jsx)(k,{label:"سÙÙ
Ù
ÛØ²Ø¨Ø§Ù",a:G.before.host_share,b:G.after.host_share}),(0,s.jsx)(k,{label:"سÙÙ
ÙÛØ¯ÙÙ
ا",a:G.before.website_share,b:G.after.website_share}),(0,s.jsx)(k,{label:"Ù
Ø§ÙØ¯Ù ÙØ§Ø±Ûز",a:G.before.clear_remainder,b:G.after.clear_remainder})]}),G.warnings.length>0&&(0,s.jsx)("div",{className:"flex flex-col gap-y-6 mb-12",children:G.warnings.map((e,a)=>(0,s.jsxs)("div",{className:"flex items-start gap-x-8",children:[(0,s.jsx)(m.Ct,{tone:"yellow",children:"ØªÙØ¬Ù"}),(0,s.jsx)("span",{className:"text-11 leading-18 text-gray-6C6A7D",children:e})]},a))}),(0,s.jsx)("p",{className:"text-12 leading-20 text-gray-6C6A7D mb-8",children:"اÛÙ ÙØ±Ø®âÙØ§ کجا اعÙ
Ø§Ù Ø´ÙØ¯Ø"}),(0,s.jsxs)("div",{className:"flex flex-col gap-y-8 mb-12",children:[(0,s.jsx)(B,{checked:"both"===v,onSelect:()=>w("both"),label:"ÙÙ
رÙÛ ØªÙÙÛÙ
Ø ÙÙ
رÙÛ Ø§Û٠رزرÙ",hint:"ØØ§Ùت Ù
عÙ
ÙÙ: ÙØ±Ø® Ø§Ø´ØªØ¨Ø§Ù Ø¨ÙØ¯Ù Ù Ø¨Ø§ÛØ¯ ÙÙ
ÙâØ¬Ø§ درست Ø´ÙØ¯."}),(0,s.jsx)(B,{checked:"reservation"===v,onSelect:()=>w("reservation"),label:"ÙÙØ· اÛ٠رزرÙ",hint:"تÙÙÛÙ
Ø§ÙØ§Ù
تگا٠دستâÙØ®Ùرد٠Ù
ÛâÙ
Ø§ÙØ¯Ø ÙÙØ· ÙÛÙ
ت ÙÙ
ÛÙ Ø±Ø²Ø±Ù Ø¹ÙØ¶ Ù
ÛâØ´ÙØ¯."}),(0,s.jsx)(B,{checked:"calendar"===v,onSelect:()=>w("calendar"),label:"ÙÙØ· تÙÙÛÙ
â Ø§Û٠رزر٠تغÛÛØ± ÙÚ©ÙØ¯",hint:"ÙÛÙ
ØªÛ Ú©Ù Ø¨Ù Ø§ÛÙ Ù
ÙÙ
Ø§Ù Ú¯ÙØªÙ شد٠سر Ø¬Ø§ÛØ´ Ù
ÛâÙ
Ø§ÙØ¯."})]}),"calendar"!==v&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("textarea",{value:F,onChange:e=>_(e.target.value),rows:2,placeholder:"ÛØ§Ø¯Ø¯Ø§Ø´Øª ÙÛÙ
تâÚ¯Ø°Ø§Ø±Û â ÚØ±Ø§ اÛÙ ÙØ±Ø® Ø¹ÙØ¶ Ù
ÛâØ´ÙØ¯Ø",className:"w-full rounded-10 border border-gray-E5E5E6 p-10 text-12 leading-20 outline-none focus:border-primary-main"}),(0,s.jsx)("p",{className:"mt-4 mb-12 text-11 leading-18 text-gray-9B9BAA",children:"با ÙØ§Ù
Ø´Ù
ا در ØªØ§Ø±ÛØ®ÚÙâÛ Ø±Ø²Ø±Ù Ø«Ø¨Øª Ù
ÛâØ´ÙØ¯."})]}),T&&(0,s.jsx)("p",{className:"mb-8 text-12 text-[#C62828]",children:T})]}):(0,s.jsx)("p",{className:"text-12 leading-20 text-gray-9B9BAA",children:"ÙÙÙØ² ÚÛØ²Û تغÛÛØ± ÙکردÙ. ÙØ±Ø®Û را از ستÙ٠راست ÛØ§ رÙÛ ØªÙÙÛÙ
Ø¹ÙØ¶ Ú©ÙÛØ¯."}),(0,s.jsxs)("div",{className:"flex items-center gap-x-8 mt-auto pt-4",children:[(0,s.jsx)(m.zx,{className:"flex-1",disabled:$||!W||"calendar"!==v&&F.trim().length<3,onClick:q,children:$?"در ØØ§Ù Ø°Ø®ÛØ±Ù...":"Ø°Ø®ÛØ±Ù کرد٠تغÛÛØ±Ø§Øª"}),(0,s.jsx)(m.zx,{variant:"secondary",disabled:$||!W,onClick:function(){g({}),b(new Set),f(""),P(null)},children:"بازگرداÙÛ"})]})]})]}):(0,s.jsx)("p",{className:"text-13 text-[#C62828]",children:"ÙØ±Ø® اÛÙ Ø±Ø²Ø±Ù Ø®ÙØ§ÙØ¯Ù ÙØ´Ø¯."})})}function S(e,a){return a.key.startsWith("special")?e.isSpecial&&e.unitPrice===a.unit_price:"peak"===a.key?!e.isSpecial&&e.isPeak:"weekend"===a.key?!e.isSpecial&&!e.isPeak&&e.isWeekend:"week"===a.key&&!e.isSpecial&&!e.isPeak&&!e.isWeekend}function D(e){let{bucket:a,draftPrice:t,onChange:n,editable:r}=e,[i,d]=(0,l.useState)(null),c=0===a.nights,o=null!==t&&t!==a.unit_price,x=null!==i?i:null===t?"":t?t.toLocaleStr
1ing("fa-IR"):"";return(0,s.jsxs)("div",{className:`grid grid-cols-[1fr_auto] gap-x-8 items-center ${c?"opacity-45":""}`,children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("span",{className:"block text-12 leading-20 text-gray-6C6A7D truncate",children:a.label}),(0,s.jsxs)("span",{className:"block text-11 leading-18 text-gray-9B9BAA",children:[c?"بدÙ٠شب":`${(0,m.N)(a.nights)} شب`,o&&(0,s.jsx)("span",{className:"text-[#B26A00]",children:" \xb7 تغÛÛØ± کردÙ"})]})]}),(0,s.jsx)("input",{inputMode:"numeric",disabled:!r||c,value:x,placeholder:null===t?"ÚÙØ¯ ÙØ±Ø®":"",onChange:e=>(function(e){d(e);let a=(0,m.EU)(e);a>0&&n(a)})(e.target.value),onBlur:()=>d(null),className:`w-[122px] px-10 py-8 rounded-10 border text-12 leading-20 text-center outline-none transition focus:border-primary-main disabled:bg-gray-F5F5F7 disabled:text-gray-9B9BAA ${o?"border-[#B26A00] bg-[#FFF4E0]":"border-gray-E5E5E6"}`})]})}function k(e){let{label:a,a:t,b:l}=e;return(0,s.jsxs)("div",{className:"flex items-baseline justify-between gap-x-10 py-2 text-12 leading-20",children:[(0,s.jsx)("span",{className:"text-gray-6C6A7D",children:a}),(0,s.jsxs)("span",{className:"whitespace-nowrap",children:[(0,s.jsx)("span",{className:"text-gray-9B9BAA",children:(0,m.N)(t)})," â ",(0,s.jsx)("b",{className:`font-m ${Math.abs(t-l)>=1?l>t?"text-[#2E7D32]":"text-[#C62828]":"text-gray-9B9BAA"}`,children:(0,m.N)(l)})]})]})}function B(e){let{checked:a,onSelect:t,label:l,hint:n}=e;return(0,s.jsxs)("label",{className:`flex items-start gap-x-8 rounded-10 border p-10 cursor-pointer transition ${a?"border-primary-main bg-primary-light":"border-gray-E5E5E6 hover:border-gray-C4CAD3"}`,children:[(0,s.jsx)("input",{type:"radio",checked:a,onChange:t,className:"w-14 h-14 mt-2 accent-[#03D6BB]"}),(0,s.jsxs)("span",{className:"min-w-0",children:[(0,s.jsx)("span",{className:`block text-12 leading-20 ${a?"text-primary-dark font-m":"text-black"}`,children:l}),(0,s.jsx)("span",{className:"block text-11 leading-18 text-gray-9B9BAA",children:n})]})]})}var F=t(33496),_=t(55290);let $=[{value:"CARD_TRANSFER",label:"کارت ب٠کارت"},{value:"BANK_TRANSFER",label:"ÙØ§Ø±Ûز باÙÚ©Û"},{value:"CASH",label:"ÙÙØ¯Û"},{value:"GATEWAY",label:"درگا٠پرداخت"},{value:"WALLET",label:"Ú©ÛÙ Ù¾ÙÙ"},{value:"OTHER",label:"Ø³Ø§ÛØ±"}];function O(e){let{reservationId:a,canRecord:t,guestWalletBalance:n,onChanged:r}=e,{data:i,isLoading:c,mutate:x}=(0,d.u)(`/api/admin/reservations/${a}/payments`,e=>(0,o.SC)(e)),[u,h]=(0,l.useState)(!1),[g,p]=(0,l.useState)(null),b=null==i?void 0:i.summary;return(0,s.jsxs)(m.Zb,{className:"p-20",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-x-12 flex-wrap gap-y-8 mb-14",children:[(0,s.jsx)("h3",{className:"text-16 leading-24 font-m text-black",children:"پرداختâÙØ§Û Ù
ÙÙ
اÙ"}),t&&(0,s.jsx)(m.zx,{onClick:()=>h(!0),children:"ثبت پرداخت"})]}),null!=n&&(0,s.jsxs)("div",{className:"mb-14 rounded-10 bg-gray-F7F7F7 px-14 py-10 flex items-center justify-between gap-x-8",children:[(0,s.jsx)("span",{className:"text-12 leading-20 text-gray-6C6A7D",children:"Ù
ÙØ¬ÙØ¯Û Ú©ÛÙ Ù¾ÙÙ Ù
ÙÙ
اÙ"}),(0,s.jsx)("b",{className:"text-14 leading-22 font-m text-black",children:(0,m.ND)(n)})]}),c||!b?(0,s.jsx)(m.Od,{className:"h-[140px]"}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-10 mb-14",children:[(0,s.jsx)(T,{label:"Ù
Ø¨ÙØº Ú©Ù Ø¬ÙØª پرداختÛ",value:(0,m.ND)(b.due)}),(0,s.jsx)(T,{label:"جÙ
ع پرداختÛ",value:(0,m.ND)(b.paid),tone:b.paid>0?"green":void 0}),(0,s.jsx)(T,{label:b.overpaid>0?"اضاÙÙâپرداخت":"باÙÛâÙ
Ø§ÙØ¯Ù",value:(0,m.ND)(b.overpaid>0?b.overpaid:b.remaining),tone:b.overpaid>0?"amber":b.remaining>0?"red":"green"})]}),b.overpaid>0&&(0,s.jsx)("p",{className:"mb-12 text-12 leading-20 text-[#B26A00]",children:"Ù
ÙÙ
Ø§Ù Ø¨ÛØ´ØªØ± از Ù
Ø¨ÙØº رزر٠پرداخت کرد٠â Ù
ابÙâØ§ÙØªÙØ§ÙØª Ø¨Ø§ÛØ¯ برگردد."}),0===i.items.length?(0,s.jsx)(m.ub,{text:b.stored_paid_amount>0?`Ù¾Ø±Ø¯Ø§Ø®ØªÛ Ø«Ø¨ØªâØ´Ø¯ÙâØ§Û Ø¯Ø± Ø¯ÙØªØ± ÙÛØ³ØªØ ÙÙÛ ${(0,m.ND)(b.stored_paid_amount)} رÙÛ Ø§Û٠رزر٠ثبت است. با اÙÙÛ٠ثبت Ù¾Ø±Ø¯Ø§Ø®ØªØ Ø§ÛÙ Ù
Ø¨ÙØº بÙâØ¹ÙÙØ§Ù Ù
Ø§ÙØ¯ÙâÛ Ø§ÙÙ ÙØ§Ø±Ø¯ Ø¯ÙØªØ± Ù
ÛâØ´ÙØ¯.`:"Ù¾Ø±Ø¯Ø§Ø®ØªÛ Ø«Ø¨Øª ÙØ´Ø¯Ù"}):(0,s.jsx)("div",{className:"rounded-12 border border-gray-E5E5E6 divide-y divide-gray-F0F0F0",children:i.items.map(e=>(0,s.jsx)(P,{payment:e,onVoid:t?()=>p(e):void 0},e.id))})]}),(0,s.jsx)(M,{open:u,reservationId:a,suggested:b?Math.max(b.remaining,0):0,guestWalletBalance:n,onClose:()=>h(!1),onDone:()=>{x(),r()}}),(0,s.jsx)(I,{payment:g,onClose:()=>p(null),onDone:()=>{x(),r()}})]})}function T(e){let{label:a,value:t,tone:l}=e;return(0,s.jsxs)("div",{className:"rounded-12 border border-gray-E5E5E6 p-12",children:[(0,s.jsx)("span",{className:"block text-11 leading-18 text-gray-9B9BAA mb-4",children:a}),(0,s.jsx)("strong",{className:`block text-14 leading-22 font-m ${"green"===l?"text-[#2E7D32]":"red"===l?"text-[#C62828]":"amber"===l?"text-[#B26A00]":"text-black"}`,children:t})]})}function P(e){let{payment:a,onVoid:t}=e,l=!!a.voided_at;return(0,s.jsxs)("div",{className:`flex items-start justify-between gap-x-12 px-14 py-10 ${l?"opacity-55":""}`,children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-x-8 flex-wrap gap-y-4",children:[(0,s.jsx)("b",{className:`text-14 leading-22 font-m ${l?"line-through text-gray-9B9BAA":"text-black"}`,children:(0,m.ND)(a.amount)}),(0,s.jsx)(m.Ct,{tone:"gray",children:a.method_label}),l&&(0,s.jsx)(m.Ct,{tone:"red",children:"باط٠شدÙ"})]}),(0,s.jsxs)("p",{className:"text-11 leading-18 text-gray-9B9BAA mt-2",children:[(0,_.R3)(a.paid_at)," ساعت ",(0,m.A1)(a.paid_at)[1],a.reference?` \xb7 Ù¾ÛÚ¯ÛØ±Û ${a.reference}`:"",a.recorded_by?` \xb7 ثبت ${a.recorded_by}`:""]}),a.note&&(0,s.jsx)("p",{className:"text-12 leading-20 text-gray-6C6A7D mt-2 break-words",children:a.note}),l&&a.voided_reason&&(0,s.jsxs)("p",{className:"text-11 leading-18 text-[#C62828] mt-2",children:["دÙÛ٠ابطاÙ: ",a.voided_reason]})]}),!l&&t&&(0,s.jsx)("button",{type:"button",onClick:t,className:"shrink-0 text-11 leading-18 text-gray-9B9BAA hover:text-[#C62828] transition",children:"ابطاÙ"})]})}function M(e){let{open:a,reservationId:t,suggested:n,guestWalletBalance:r,onClose:i,onDone:d}=e,[c,x]=(0,l.useState)(""),[u,h]=(0,l.useState)("CARD_TRANSFER"),[g,p]=(0,l.useState)(()=>new Date().toISOString().slice(0,10)),[b,j]=(0,l.useState)(()=>
1new Date().toTimeString().slice(0,5)),[y,N]=(0,l.useState)(""),[f,v]=(0,l.useState)(""),[C,A]=(0,l.useState)(!1),[E,w]=(0,l.useState)(null),S=(0,m.EU)(c);async function D(){A(!0),w(null);try{await (0,o.SC)(`/api/admin/reservations/${t}/payments`,{method:"POST",body:JSON.stringify({amount:S,method:u,paidAt:new Date(`${g}T${b||"00:00"}`).toISOString(),reference:y.trim()||null,note:f.trim()||null})}),x(""),N(""),v(""),d(),i()}catch(e){w(e instanceof Error?e.message:"ثبت ÙØ´Ø¯")}finally{A(!1)}}return(0,s.jsxs)(m.u_,{open:a,onClose:i,title:"ثبت پرداخت Ù
ÙÙ
اÙ",width:"max-w-[520px]",children:[(0,s.jsxs)("label",{className:"block mb-12",children:[(0,s.jsx)("span",{className:"block mb-6 text-12 leading-18 text-gray-6C6A7D font-m",children:"Ù
Ø¨ÙØº (تÙÙ
اÙ)"}),(0,s.jsx)("input",{inputMode:"numeric",value:S?S.toLocaleString("fa-IR"):"",onChange:e=>x(e.target.value),placeholder:"Ù
Ø¨ÙØº اÛÙ ÙØ§Ø±Ûز",className:"w-full px-14 py-10 rounded-10 border border-gray-E5E5E6 text-14 leading-22 outline-none focus:border-primary-main"}),n>0&&(0,s.jsxs)("button",{type:"button",onClick:()=>x(String(n)),className:"mt-6 text-11 leading-18 text-primary-dark hover:underline",children:["ک٠باÙÛâÙ
Ø§ÙØ¯Ù: ",(0,m.N)(n)," تÙÙ
اÙ"]})]}),(0,s.jsxs)("div",{className:"grid md:grid-cols-2 gap-12 mb-12",children:[(0,s.jsxs)("label",{className:"block",children:[(0,s.jsx)("span",{className:"block mb-6 text-12 leading-18 text-gray-6C6A7D font-m",children:"Ø±ÙØ´ پرداخت"}),(0,s.jsx)("select",{value:u,onChange:e=>h(e.target.value),className:"w-full px-14 py-10 rounded-10 border border-gray-E5E5E6 text-14 leading-22 bg-white outline-none focus:border-primary-main",children:$.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label},e.value))})]}),(0,s.jsx)(_.ZP,{label:"ØªØ§Ø±ÛØ® ÙØ§Ø±Ûز",value:g,onChange:p})]}),"WALLET"===u&&(0,s.jsxs)("p",{className:`mb-12 text-12 leading-20 rounded-8 px-10 py-8 ${null!=r&&S>r?"bg-[#FFF4E5] text-[#B26A00]":"bg-gray-F5F5F7 text-gray-6C6A7D"}`,children:["اÛÙ Ù
Ø¨ÙØº از Ù
ÙØ¬ÙØ¯Û Ú©ÛÙ Ù¾ÙÙ Ù
ÙÙ
ا٠کسر Ù
ÛâØ´ÙØ¯.",null!=r&&(0,s.jsxs)(s.Fragment,{children:[" ","Ù
ÙØ¬ÙØ¯Û ÙØ¹ÙÛ: ",(0,s.jsx)("b",{children:(0,m.ND)(r)}),S>r&&" â Ú©Ù
تر از Ù
Ø¨ÙØº ÙØ§Ø±Ø¯Ø´Ø¯Ù است."]})]}),(0,s.jsxs)("label",{className:"block mb-12",children:[(0,s.jsx)("span",{className:"block mb-6 text-12 leading-18 text-gray-6C6A7D font-m",children:"ساعت ÙØ§Ø±Ûز"}),(0,s.jsx)("input",{type:"time",value:b,onChange:e=>j(e.target.value),className:"w-full px-14 py-10 rounded-10 border border-gray-E5E5E6 text-14 leading-22 outline-none focus:border-primary-main"})]}),(0,s.jsxs)("label",{className:"block mb-12",children:[(0,s.jsx)("span",{className:"block mb-6 text-12 leading-18 text-gray-6C6A7D font-m",children:"Ø´Ù
ار٠پÛÚ¯ÛØ±Û / ÙÛØ´ (Ø§Ø®ØªÛØ§Ø±Û)"}),(0,s.jsx)("input",{value:y,onChange:e=>N(e.target.value),dir:"ltr",className:"w-full px-14 py-10 rounded-10 border border-gray-E5E5E6 text-14 leading-22 text-right outline-none focus:border-primary-main"})]}),(0,s.jsx)("textarea",{value:f,onChange:e=>v(e.target.value),rows:2,placeholder:"ØªÙØ¶ÛØ (Ø§Ø®ØªÛØ§Ø±Û)",className:"w-full rounded-10 border border-gray-E5E5E6 p-12 text-13 leading-22 outline-none focus:border-primary-main"}),E&&(0,s.jsx)("p",{className:"mt-10 text-13 text-[#C62828]",children:E}),(0,s.jsxs)("div",{className:"flex justify-end gap-x-8 mt-16",children:[(0,s.jsx)(m.zx,{variant:"secondary",onClick:i,children:"Ø§ÙØµØ±Ø§Ù"}),(0,s.jsx)(m.zx,{disabled:C||S<=0||!g,onClick:D,children:C?"در ØØ§Ù ثبت...":"ثبت پرداخت"})]})]})}function I(e){let{payment:a,onClose:t,onDone:n}=e,[r,i]=(0,l.useState)(""),[d,c]=(0,l.useState)(!1),[x,u]=(0,l.useState)(null);async function h(){if(a){c(!0),u(null);try{await (0,o.SC)(`/api/admin/payments/${a.id}/void`,{method:"POST",body:JSON.stringify({reason:r.trim()})}),i(""),n(),t()}catch(e){u(e instanceof Error?e.message:"Ø§Ø¨Ø·Ø§Ù ÙØ´Ø¯")}finally{c(!1)}}}return(0,s.jsxs)(m.u_,{open:!!a,onClose:t,title:"ابطا٠پرداخت",width:"max-w-[460px]",children:[(0,s.jsxs)("p",{className:"text-13 leading-22 text-gray-6C6A7D mb-10",children:["پرداخت ",(0,s.jsx)("b",{className:"text-black",children:a&&(0,m.ND)(a.amount)})," از جÙ
ع Ù¾Ø±Ø¯Ø§Ø®ØªÛ Ú©Ø³Ø± Ù
ÛâØ´ÙØ¯. ردÛ٠پاک ÙÙ
ÛâØ´ÙØ¯ ٠با دÙÛÙ Ø´Ù
ا در Ø¯ÙØªØ± Ù
ÛâÙ
Ø§ÙØ¯."]}),(0,s.jsx)("textarea",{value:r,onChange:e=>i(e.target.value),rows:3,placeholder:"ÚØ±Ø§ اÛ٠پرداخت باط٠Ù
ÛâØ´ÙØ¯Ø",className:"w-full rounded-10 border border-gray-E5E5E6 p-12 text-13 leading-22 outline-none focus:border-primary-main"}),x&&(0,s.jsx)("p",{className:"mt-10 text-13 text-[#C62828]",children:x}),(0,s.jsxs)("div",{className:"flex justify-end gap-x-8 mt-16",children:[(0,s.jsx)(m.zx,{variant:"secondary",onClick:t,children:"Ø§ÙØµØ±Ø§Ù"}),(0,s.jsx)(m.zx,{variant:"danger",disabled:d||r.trim().length<3,onClick:h,children:d?"در ØØ§Ù ابطاÙ...":"ابطا٠پرداخت"})]})]})}function L(e){let{open:a,onClose:t,reservationId:n,terms:r,onSaved:i}=e,[d,c]=(0,l.useState)(""),[x,u]=(0,l.useState)(""),[h,g]=(0,l.useState)(""),[p,b]=(0,l.useState)(""),[j,y]=(0,l.useState)(null),[N,f]=(0,l.useState)(!1),[v,C]=(0,l.useState)(null);(0,l.useEffect)(()=>{a&&(c(String(Math.round(r.websiteShare??0))),u(String(Math.round(r.vatAmount??0))),g(String(Math.round(r.guestCommission??0))),b(""),y(null),C(null))},[a,r.websiteShare,r.vatAmount,r.guestCommission]);let A=e=>
1(0,m.EU)(e),E={websiteShare:A(d),vatAmount:A(x),guestCommission:A(h)},w=E.websiteShare!==Math.round(r.websiteShare??0)||E.vatAmount!==Math.round(r.vatAmount??0)||E.guestCommission!==Math.round(r.guestCommission??0);async function S(){f(!0),C(null);try{let e=await (0,o.SC)(`/api/admin/reservations/${n}/terms`,{method:"PATCH",body:JSON.stringify({...E,dryRun:!0})});y(e)}catch(e){C(e instanceof Error?e.message:"Ù
ØØ§Ø³Ø¨Ù ÙØ´Ø¯")}finally{f(!1)}}async function D(){f(!0),C(null);try{await (0,o.SC)(`/api/admin/reservations/${n}/terms`,{method:"PATCH",body:JSON.stringify({...E,note:p.trim()})}),i(),t()}catch(e){C(e instanceof Error?e.message:"Ø°Ø®ÛØ±Ù ÙØ´Ø¯")}finally{f(!1)}}let k=Math.max(r.totalAmount-E.websiteShare-E.vatAmount,0),B=(e,a)=>a>0?e/a*100:0;return(0,s.jsxs)(m.u_,{open:a,onClose:t,title:"ÙÛØ±Ø§ÛØ´ کارÙ
زد Ù Ù
اÙÛØ§Øª",width:"max-w-[560px]",children:[(0,s.jsxs)("p",{className:"text-12 leading-20 text-gray-9B9BAA mb-14",children:["Ù
Ø¨ÙØº ک٠اجار٠(",(0,m.ND)(r.totalAmount),") از ÙØ±Ø® شبâÙØ§ Ù
ÛâØ¢ÛØ¯ ٠اÛÙØ¬Ø§ تغÛÛØ± ÙÙ
ÛâÚ©ÙØ¯ â Ø¨Ø±Ø§Û آ٠از \xabÙÛØ±Ø§ÛØ´ ÙÛÙ
ت رزرÙ\xbb Ø§Ø³ØªÙØ§Ø¯Ù Ú©ÙÛØ¯."]}),(0,s.jsx)(R,{label:"سÙÙ
ÙÛØ¯ÙÙ
ا",hint:`${(0,m.N)(Math.round(10*B(E.websiteShare,r.totalAmount))/10)}Ùª از اجارÙ`,value:d,onChange:e=>{c(e),y(null)}}),(0,s.jsx)(R,{label:"ارزش Ø§ÙØ²ÙدÙ",hint:`${(0,m.N)(Math.round(10*B(E.vatAmount,E.websiteShare))/10)}Ùª از کارÙ
زد`,value:x,onChange:e=>{u(e),y(null)}}),(0,s.jsx)(R,{label:"کارÙ
زد رزر٠Ù
ÙÙ
اÙ",hint:`${(0,m.N)(Math.round(10*B(E.guestCommission,r.totalAmount))/10)}ÙªØ Ø§ÙØ²ÙØ¯Ù Ø¨Ù Ù¾Ø±Ø¯Ø§Ø®ØªÛ Ù
ÙÙ
اÙ`,value:h,onChange:e=>{g(e),y(null)}}),(0,s.jsxs)("div",{className:"rounded-10 bg-gray-F5F5F7 p-12 mt-4 mb-14",children:[(0,s.jsx)(G,{label:"سÙÙ
Ù
ÛØ²Ø¨Ø§Ù پس از کسر",value:(0,m.ND)(k),strong:!0}),(0,s.jsx)(G,{label:"Ù
Ø¨ÙØº Ú©Ù Ø¬ÙØª Ù¾Ø±Ø¯Ø§Ø®ØªÛ Ù
ÙÙ
اÙ",value:(0,m.ND)(r.totalAmount+E.guestCommission)})]}),j&&(0,s.jsxs)("div",{className:"rounded-10 border border-gray-E5E5E6 p-12 mb-14",children:[(0,s.jsx)("p",{className:"text-12 leading-20 text-gray-6C6A7D mb-8",children:"پس از Ø°Ø®ÛØ±Ù"}),(0,s.jsx)(z,{label:"سÙÙ
Ù
ÛØ²Ø¨Ø§Ù",a:j.before.host_share,b:j.after.host_share}),(0,s.jsx)(z,{label:"کارÙ
زد Ø³Ø§ÛØª",a:j.before.website_share,b:j.after.website_share}),(0,s.jsx)(z,{label:"ارزش Ø§ÙØ²ÙدÙ",a:j.before.vat_amount,b:j.after.vat_amount}),(0,s.jsx)(z,{label:"کارÙ
زد رزر٠Ù
ÙÙ
اÙ",a:j.before.guest_commission,b:j.after.guest_commission}),j.warnings.map((e,a)=>(0,s.jsxs)("div",{className:"flex items-start gap-x-8 mt-8",children:[(0,s.jsx)(m.Ct,{tone:"yellow",children:"ØªÙØ¬Ù"}),(0,s.jsx)("span",{className:"text-11 leading-18 text-gray-6C6A7D",children:e})]},a))]}),(0,s.jsx)("textarea",{value:p,onChange:e=>b(e.target.value),rows:2,placeholder:"ØªÙØ¶ÛØ â ÚØ±Ø§ اÛÙ Ù
Ø¨Ø§ÙØº Ø¹ÙØ¶ Ù
ÛâØ´ÙØ¯Ø",className:"w-full rounded-10 border border-gray-E5E5E6 p-12 text-13 leading-22 outline-none focus:border-primary-main"}),(0,s.jsx)("p",{className:"mt-4 text-11 leading-18 text-gray-9B9BAA",children:"با ÙØ§Ù
Ø´Ù
ا در ØªØ§Ø±ÛØ®ÚÙâÛ Ø±Ø²Ø±Ù Ø«Ø¨Øª Ù
ÛâØ´ÙØ¯."}),v&&(0,s.jsx)("p",{className:"mt-10 text-13 text-[#C62828]",children:v}),(0,s.jsxs)("div",{className:"flex justify-end gap-x-8 mt-16",children:[(0,s.jsx)(m.zx,{variant:"secondary",onClick:t,children:"Ø§ÙØµØ±Ø§Ù"}),j?(0,s.jsx)(m.zx,{disabled:N||p.trim().length<3,onClick:D,children:N?"در ØØ§Ù Ø°Ø®ÛØ±Ù...":"Ø°Ø®ÛØ±Ù"}):(0,s.jsx)(m.zx,{disabled:N||!w,onClick:S,children:N?"...":"Ù
ØØ§Ø³Ø¨ÙâÛ ØªØºÛÛØ±"})]})]})}function R(e){let{label:a,hint:t,value:l,onChange:n}=e,r=(0,m.EU)(l);return(0,s.jsxs)("label",{className:"grid grid-cols-[1fr_auto] gap-x-10 items-center mb-10",children:[(0,s.jsxs)("span",{className:"min-w-0",children:[(0,s.jsx)("span",{className:"block text-13 leading-20 text-black",children:a}),(0,s.jsx)("span",{className:"block text-11 leading-18 text-gray-9B9BAA",children:t})]}
1),(0,s.jsx)("input",{inputMode:"numeric",value:r?r.toLocaleString("fa-IR"):"",onChange:e=>n(e.target.value),placeholder:"Û°",className:"w-[150px] px-12 py-8 rounded-10 border border-gray-E5E5E6 text-13 leading-20 text-center outline-none focus:border-primary-main"})]})}function G(e){let{label:a,value:t,strong:l}=e;return(0,s.jsxs)("div",{className:"flex items-baseline justify-between gap-x-12 py-2",children:[(0,s.jsx)("span",{className:"text-12 leading-20 text-gray-6C6A7D",children:a}),(0,s.jsx)("span",{className:`text-13 leading-20 whitespace-nowrap ${l?"font-m text-black":"text-gray-6C6A7D"}`,children:t})]})}function z(e){let{label:a,a:t,b:l}=e;return(0,s.jsxs)("div",{className:"flex items-baseline justify-between gap-x-10 py-2 text-12 leading-20",children:[(0,s.jsx)("span",{className:"text-gray-6C6A7D",children:a}),(0,s.jsxs)("span",{className:"whitespace-nowrap",children:[(0,s.jsx)("span",{className:"text-gray-9B9BAA",children:(0,m.N)(Math.round(t))})," â ",(0,s.jsx)("b",{className:`font-m ${Math.abs(t-l)>=1?l>t?"text-[#2E7D32]":"text-[#C62828]":"text-gray-9B9BAA"}`,children:(0,m.N)(Math.round(l))})]})]})}var U=t(70707);function Y(e){let{open:a,onClose:t,reservationId:n,invoice:r,onSaved:i}=e,[d,c]=(0,l.useState)(""),[x,u]=(0,l.useState)(""),[h,g]=(0,l.useState)(""),[p,b]=(0,l.useState)(null),[j,y]=(0,l.useState)(!1),[N,f]=(0,l.useState)(null);(0,l.useEffect)(()=>{a&&(c(r.hostGiftDiscount?String(r.hostGiftDiscount):""),u(r.siteGiftDiscount?String(r.siteGiftDiscount):""),g(""),b(null),f(null))},[a,r.hostGiftDiscount,r.siteGiftDiscount]);let v=()=>({hostGiftDiscount:(0,U.EU)(d),siteGiftDiscount:(0,U.EU)(x)});async function C(e){y(!0),f(null);try{let a=await (0,o.SC)(`/api/admin/reservations/${n}/gift-discounts`,{method:"PATCH",body:JSON.stringify({...v(),note:h.trim(),dryRun:e})});e?b(a):(i(),t())}catch(e){f(e instanceof Error?e.message:"Ø§ÙØ¬Ø§Ù
ÙØ´Ø¯")}finally{y(!1)}}return(0,s.jsxs)(m.u_,{open:a,onClose:t,title:"تخÙÛÙ ÙØ¯ÛÙ",width:"max-w-[560px]",children:[(0,s.jsxs)("p",{className:"mb-16 rounded-10 bg-gray-F7F7F7 px-14 py-10 text-12 leading-20 text-gray-6C6A7D",children:["ÙØ± د٠ب٠ÛÚ© Ø§ÙØ¯Ø§Ø²Ù از ØµÙØ±ØªØØ³Ø§Ø¨ Ù
ÙÙ
ا٠کÙ
Ù
ÛâÚ©ÙÙØ¯. ØªÙØ§Ùتشا٠اÛ٠است Ú©Ù"," ",(0,s.jsx)("b",{className:"text-black",children:"ÙØ¯ÛÙ Ù
ÛØ²Ø¨Ø§Ù"})," از ÙØ§Ø±ÛØ²Û Ø®ÙØ¯Ù Ù
ÛØ²Ø¨Ø§Ù Ú©Ù
Ù
ÛâØ´ÙØ¯ Ù"," ",(0,s.jsx)("b",{className:"text-black",children:"ÙØ¯ÛÙ Ø³Ø§ÛØª"})," از سÙÙ
ÙÛØ¯ÙÙ
ا â ÙØ§Ø±ÛØ²Û Ù
ÛØ²Ø¨Ø§Ù را دست ÙÙ
ÛâØ²ÙØ¯."]}),(0,s.jsxs)("div",{className:"grid md:grid-cols-2 gap-14",children:[(0,s.jsx)(m.gN,{label:"تخÙÛÙ ÙØ¯ÛÙ Ù
ÛØ²Ø¨Ø§Ù (تÙÙ
اÙ)",hint:`ØØ¯Ø§Ú©Ø«Ø± ${(0,m.ND)(r.hostShareBeforeGift)} â Ø³ÙÙ
Ù
ÛØ²Ø¨Ø§Ù از اÛ٠رزرÙ`,children:(0,s.jsx)(m.II,{inputMode:"numeric",value:d,onChange:e=>c(e.target.value)})}),(0,s.jsx)(m.gN,{label:"تخÙÛÙ ÙØ¯ÛÙ Ø³Ø§ÛØª (تÙÙ
اÙ)",hint:"از سÙÙ
ÙÛØ¯ÙÙ
ا پرداخت Ù
ÛâØ´ÙØ¯",children:(0,s.jsx)(m.II,{inputMode:"numeric",value:x,onChange:e=>u(e.target.value)})})]}),(0,s.jsx)(m.gN,{label:"ØªÙØ¶ÛØ (Ø§ÙØ²Ø§Ù
Û)",className:"mt-14",children:(0,s.jsx)(m.II,{value:h,onChange:e=>g(e.target.value),placeholder:"ÚØ±Ø§ اÛ٠تخÙÛ٠ثبت Ù
ÛâØ´ÙØ¯Ø"})}),N&&(0,s.jsx)("p",{className:"mt-14 rounded-10 bg-[#FEE] px-14 py-10 text-13 text-[#C62828]",children:N}),p&&(0,s.jsxs)("div",{className:"mt-16 rounded-12 border border-gray-E5E5E6 p-14",children:[(0,s.jsx)("p",{className:"mb-10 text-13 font-m text-black",children:"Ù¾ÛØ´âÙÙ
Ø§ÛØ´"}),(0,s.jsx)(H,{label:"Ù
Ø¨ÙØº ÙÙØ§ÛÛ ÙØ§Ø¨Ù پرداخت Ù
ÙÙ
اÙ",from:p.before.guest_payable,to:p.after.guest_payable}),(0,s.jsx)(H,{label:"Ù
Ø¨ÙØº ÙÙØ§ÛÛ Ø¯Ø±ÛØ§Ùت Ù
ÛØ²Ø¨Ø§Ù",from:p.before.host_share,to:p.after.host_share}),p.warnings.map(e=>(0,s.jsxs)("p",{className:"mt-8 text-12 leading-20 text-[#B26A00]",children:["â ",e]},e))]}),(0,s.jsxs)("div",{className:"mt-20 flex items-center justify-end gap-x-8",children:[(0,s.jsx)(m.zx,{variant:"ghost",onClick:t,children:"Ø§ÙØµØ±Ø§Ù"}),(0,s.jsx)(m.zx,{variant:"secondary",disabled:j,onClick:()=>C(!0),children:"Ù¾ÛØ´âÙÙ
Ø§ÛØ´"}),(0,s.jsx)(m.zx,{disabled:j||!h.trim(),onClick:()=>C(!1),children:j?"در ØØ§Ù ثبتâ¦":"ثبت تخÙÛÙ"})]})]})}function H(e){let{label:a,from:t,to:l}=e,n=l-t;return(0,s.jsxs)("div",{className:"flex items-baseline justify-between gap-x-12 py-4",children:[(0,s.jsx)("span",{className:"text-12 leading-20 text-gray-9B9BAA",children:a}),(0,s.jsxs)("span",{className:"text-13 leading-20 whitespace-nowrap",children:[(0,s.jsx)("span",{className:"text-gray-9B9BAA line-through",children:(0,m.ND)(t)}),(0,s.jsx)("span",{className:"mx-6",children:"â"}),(0,s.jsx)("span",{className:"font-m text-black",children:(0,m.ND)(l)}),0!==n&&(0,s.jsxs)(m.Ct,{tone:n<0?"red":"green",children:[n<0?"â":"+",(0,m.N)(Math.abs(n))]})]})]})}function Z(e){let{invoice:a}=e,t=e=>e?` (${(0,m.N)(e)}Ùª)`:"",l=a.stay;return(0,s.jsxs)(m.Zb,{className:"p-20",children:[(0,s.jsx)("h3",{className:"text-14 leading-22 font-m text-black mb-2",children:"ØµÙØ±ØªØØ³Ø§Ø¨ ÙØ± طرÙ"}),(0,s.jsx)("p",{className:"text-11 leading-18 text-gray-9B9BAA mb-14",children:"دÙÛÙØ§Ù ÙÙ
ا٠ÚÛØ²Û Ú©Ù Ù
ÙÙ
ا٠٠Ù
ÛØ²Ø¨Ø§Ù در Ù¾ÙÙ Ø®ÙØ¯Ø´Ø§Ù Ù
ÛâØ¨ÛÙÙØ¯."}),(0,s.jsxs)("div",{className:"rounded-12 border border-gray-E5E5E6 p-14 mb-16",children:[(0,s.jsx)("p",{className:"mb-8 text-12 leading-20 font-m text-gray-6C6A7D",children:"Ø¬Ø²Ø¦ÛØ§Øª Ù
Ø¨ÙØº ک٠رزرÙ"}),l?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(J,{label:"Ø±ÙØ²ÙØ§Û ÙØ³Ø· ÙÙØªÙ",nights:l.weekdayNights,unit:l.weekdayUnit,total:l.weekdayTotal}),(0,s.jsx)(J,{label:"Ø±ÙØ²ÙØ§Û Ø¢Ø®Ø± ÙÙØªÙ",nights:l.weekendNights,unit:l.weekendUnit,total:l.weekendTotal}),(0,s.jsx)(J,{label:"Ø±ÙØ²ÙØ§Û Ø§ÛØ§Ù
Ù¾ÛÚ©",nights:l.peakNights,unit:l.peakUnit,total:l.peakTotal}),(0,s.jsx)(J,{label:"Ø±ÙØ²ÙØ§Û Ø®Ø§Øµ",nights:l.specialNights,unit:l.specialUnit,total:l.specialTotal}),l.extraGuests>0&&(0,s.jsx)(J,{label:"ÙØ±Ø® ÙÙØ± اضاÙÙ",nights:l.extraGuests,unitLabel:"ÙÙØ±",total:l.extraGuestsTotal}),l.lengthDiscountAmount>0&&(0,s.jsx)(X,{label:`تخÙÛÙ Ù
دت رزرÙ${t(l.lengthDiscountPercent)}`,value:-l.lengthDiscountAmount,negative:!0}),(0,s.jsx)("div",{className:"mt-8 pt-8 border-t border-gray-F0F0F0",children:(0,s.jsx)(X,{label:"Ù
Ø¨ÙØº ک٠رزرÙ",value:a.totalAmount,strong:!0})})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(X,{label:"Ù
Ø¨ÙØº ک٠رزرÙ",value:a.totalAmount,strong:!0}),(0,s.jsx)("p",{className:"mt-6 text-11 leading-18 text-gray-9B9BAA",children:"تÙÚ©ÛÚ© شبâÙØ§ Ø¨Ø±Ø§Û Ø§ÛÙ Ø±Ø²Ø±Ù Ø°Ø®ÛØ±Ù ÙØ´Ø¯Ù â Ù¾ÛØ´ از Ø§ÙØ²ÙدÙâØ´Ø¯Ù Ø§Û٠ستÙ٠ثبت شد٠است."})]})]}),(0,s.jsxs)("div",{className:"grid md:grid-cols-2 gap-x-20 gap-y-14",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-8 text-12 leading-20 font-m text-gray-6C6A7D",children:"Ù
ÙÙ
ا٠Ù
ÛâØ¨ÛÙØ¯"}),(0,s.jsx)(X,{label:"Ù
Ø¨ÙØº ک٠رزرÙ",value:a.totalAmount}),a.codeDiscount>0&&(0,s.jsx)(X,{label:`کد تخÙÛÙ${a.discountCode?` (${a.discountCode})`:""}`,value:-a.codeDiscount,negative:!0}),a.hostGiftDiscount>0&&(0,s.jsx)(X,{label:"تخÙÛÙ ÙØ¯ÛÙ Ù
ÛØ²Ø¨Ø§Ù",value:-a.hostGiftDiscount,negative:!0}),a.siteGiftDiscount>0&&(0,s.jsx)(X,{label:"تخÙÛÙ ÙØ¯ÛÙ Ø³Ø§ÛØª",value:-a.siteGiftDiscount,negative:!0}),a.totalDiscount>0&&(0,s.jsx)(X,{label:"Ù
Ø¨ÙØº ÙÙØ§ÛÛ ØµÙØ±ØªØØ³Ø§Ø¨",value:a.invoiceAmount}),(0,s.jsx)(X,{label:`کارÙ
زد رزر٠Ù
ÙÙ
اÙ${t(a.guestCommissionPercent)}`,value:a.guestCommission}),(0,s.jsx)(X,{label:"Ù
Ø¨ÙØº ÙÙØ§ÛÛ ÙØ§Ø¨Ù پرداخت Ù
ÙÙ
اÙ",value:a.guestPayable,strong:!0})]}),(0,s.jsxs)("div",{className:"md:border-r md:border-gray-F0F0F0 md:pr-20",children:[(0,s.jsx)("p",{className:"mb-8 text-12 leading-20 font-m text-gray-6C6A7D",children:"Ù
ÛØ²Ø¨Ø§Ù Ù
ÛâØ¨ÛÙØ¯"}),(0,s.jsx)(X,{label:"Ù
Ø¨ÙØº ک٠رزرÙ",value:a.totalAmount}),(0,s.jsx)(X,{label:`سÙÙ
ÙÛØ¯ÙÙ
ا${t(a.commissionPercent)}`,value:-a.websiteShare,negative:!0}),(0,s.jsx)(X,{label:`ارزش Ø§ÙØ²ÙدÙ${a.vatPercent?` (${(0,m.N)(a.vatPercent)}Ùª از سÙÙ
ÙÛØ¯ÙÙ
ا)`:""}
1`,value:-a.vatAmount,negative:!0}),a.hostGiftDiscount>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(X,{label:"Ø¯Ø±ÛØ§ÙØªÛ Ù¾ÛØ´ از ÙØ¯ÛÙ",value:a.hostShareBeforeGift}),(0,s.jsx)(X,{label:"تخÙÛÙ ÙØ¯ÛÙ Ù
ÛØ²Ø¨Ø§Ù",value:-a.hostGiftDiscount,negative:!0})]}),(0,s.jsx)(X,{label:"Ù
Ø¨ÙØº ÙÙØ§ÛÛ Ø¯Ø±ÛØ§Ùت Ù
ÛØ²Ø¨Ø§Ù",value:a.hostShare,strong:!0}),(a.codeDiscount>0||a.siteGiftDiscount>0)&&(0,s.jsx)("p",{className:"mt-8 text-11 leading-18 text-gray-9B9BAA",children:"کد تخÙÛÙ Ù ÙØ¯ÛÙ Ø³Ø§ÛØª از سÙÙ
ÙÛØ¯ÙÙ
ا پرداخت Ù
ÛâØ´ÙÙØ¯ ٠رÙÛ Ø§Û٠عدد Ø§Ø«Ø±Û ÙØ¯Ø§Ø±Ùد."})]})]})]})}function J(e){let{label:a,nights:t,unit:l,total:n,unitLabel:r="شب"}=e;return t?(0,s.jsxs)("div",{className:"flex items-baseline justify-between gap-x-10 py-3",children:[(0,s.jsxs)("span",{className:"text-12 leading-20 text-gray-9B9BAA min-w-0",children:[a,(0,s.jsxs)("span",{className:"text-11 text-gray-C4CAD3",children:[" \xb7 ",(0,m.N)(t)," ",r,l?` \xd7 ${(0,m.ND)(l)}`:""]})]}),(0,s.jsx)("span",{className:"text-13 leading-20 whitespace-nowrap text-gray-6C6A7D",children:(0,m.ND)(n)})]}):null}function X(e){let{label:a,value:t,strong:l,negative:n}=e;return(0,s.jsxs)("div",{className:"flex items-baseline justify-between gap-x-10 py-3",children:[(0,s.jsx)("span",{className:"text-12 leading-20 text-gray-9B9BAA min-w-0",children:a}),(0,s.jsx)("span",{className:`text-13 leading-20 whitespace-nowrap ${n?"text-[#C62828]":l?"font-m text-black":"text-gray-6C6A7D"}`,children:t<0?`â${(0,m.ND)(Math.abs(t))}`:(0,m.ND)(t)})]})}let V=(e,a)=>C()(e,"YYYY-MM-DD").add(a,"day").format("YYYY-MM-DD");function W(e){var a,t;let{open:n,onClose:r,reservationId:i,stay:d,onSaved:c}=e,[x,u]=(0,l.useState)(""),[h,g]=(0,l.useState)(1),[p,b]=(0,l.useState)(1),[j,y]=(0,l.useState)(""),[N,f]=(0,l.useState)(null),[v,C]=(0,l.useState)(!1),[A,E]=(0,l.useState)(null);(0,l.useEffect)(()=>{n&&(u(d.startDate.slice(0,10)),g(Math.max(d.daysCount,1)),b(d.guestsCount),y(""),f(null),E(null))},[n,d.startDate,d.daysCount,d.guestsCount]);let w=x?V(x,h):"",S=(a=d.capacity,t=d.maxCapacity,a?Math.max(Math.min(p,t??p)-a,0):0),D=x!==d.startDate.slice(0,10)||h!==d.daysCount||p!==d.guestsCount||S!==d.extraGuestsCount,k=!!d.maxCapacity&&p>d.maxCapacity;async function B(e){C(!0),E(null);try{let a=await (0,o.SC)(`/api/admin/reservations/${i}/stay`,{method:"PATCH",body:JSON.stringify({startDate:x,endDate:w,guestsCount:p,extraGuestsCount:S,dryRun:e,...e?{}:{note:j.trim()}})});e?f(a):(c(),r())}catch(a){E(a instanceof Error?a.message:e?"Ù
ØØ§Ø³Ø¨Ù ÙØ´Ø¯":"Ø°Ø®ÛØ±Ù ÙØ´Ø¯")}finally{C(!1)}}let F=!!N&&N.clashes.length>0;return(0,s.jsxs)(m.u_,{open:n,onClose:r,title:"ÙÛØ±Ø§ÛØ´ Ø§ÙØ§Ù
ت",width:"max-w-[560px]",children:[(0,s.jsxs)("div",{className:"grid md:grid-cols-2 gap-12 mb-12",children:[(0,s.jsx)(_.ZP,{label:"ØªØ§Ø±ÛØ® ÙØ±Ùد",value:x,onChange:e=>{u(e),f(null)}}),(0,s.jsx)(K,{label:"تعداد شب",value:h,min:1,onChange:e=>{g(e),f(null)}})]}),(0,s.jsxs)("div",{className:"rounded-10 bg-gray-F5F5F7 px-12 py-10 mb-12 flex items-center justify-between gap-x-12 flex-wrap gap-y-6",children:[(0,s.jsx)("span",{className:"text-12 leading-20 text-gray-6C6A7D",children:"ØªØ§Ø±ÛØ® Ø®Ø±ÙØ¬"}),(0,s.jsx)("b",{className:"text-14 leading-22 font-m text-black",children:(0,_.R3)(w)})]}),(0,s.jsxs)("div",{className:"grid md:grid-cols-2 gap-12 mb-4",children:[(0,s.jsx)(K,{label:"تعداد Ù
ÙÙ
Ø§ÙØ§Ù",value:p,min:1,max:d.maxCapacity??void 0,onChange:e=>{b(e),f(null)}}),(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"block mb-6 text-12 leading-18 text-gray-6C6A7D font-m",children:"ÙÙØ±Ø§Øª اضاÙÙ"}),(0,s.jsxs)("div",{className:"px-14 py-10 rounded-10 border border-gray-E5E5E6 bg-gray-F5F5F7 text-14 leading-22 text-center text-black",children:[(0,m.N)(S)," ÙÙØ±"]}),(0,s.jsx)("span",{className:"block mt-4 text-11 leading-18 text-gray-9B9BAA",children:d.capacity?`ظرÙÛØª پاÛÙ ${(0,m.N)(d.capacity)} ÙÙØ±${d.maxCapacity?` \xb7 ØØ¯Ø§Ú©Ø«Ø± ${(0,m.N)(d.maxCapacity)}`:""}`:"ظرÙÛØª پاÛÙâÛ Ø§ÙØ§Ù
تگا٠ثبت ÙØ´Ø¯Ù"})]})]}
1),k&&(0,s.jsxs)("p",{className:"mb-12 text-12 leading-20 text-[#C62828]",children:["ظرÙÛØª اÛÙ Ø§ÙØ§Ù
ØªÚ¯Ø§Ù ØØ¯Ø§Ú©Ø«Ø± ",(0,m.N)(d.maxCapacity)," ÙÙØ± است."]}),N&&(0,s.jsxs)("div",{className:"rounded-10 border border-gray-E5E5E6 p-12 mt-8 mb-14",children:[(0,s.jsx)("p",{className:"text-12 leading-20 text-gray-6C6A7D mb-8",children:"پس از Ø°Ø®ÛØ±Ù"}),(0,s.jsx)(q,{label:"Ù
Ø¨ÙØº ک٠اجارÙ",a:N.before.total_amount,b:N.after.total_amount}),(0,s.jsx)(q,{label:"سÙÙ
Ù
ÛØ²Ø¨Ø§Ù",a:N.before.host_share,b:N.after.host_share}),(0,s.jsx)(q,{label:"کارÙ
زد رزر٠Ù
ÙÙ
اÙ",a:N.before.guest_commission,b:N.after.guest_commission}),N.clashes.length>0&&(0,s.jsx)("div",{className:"mt-10 rounded-8 bg-[#FFEBEB] p-10",children:(0,s.jsxs)("p",{className:"text-12 leading-20 text-[#C62828]",children:["اÛ٠باز٠با رزر٠",N.clashes.map(e=>e.reference).join("Ø ")," تداخ٠دارد Ù Ø°Ø®ÛØ±Ù ÙÙ
ÛâØ´ÙØ¯."]})}),N.warnings.map((e,a)=>(0,s.jsxs)("div",{className:"flex items-start gap-x-8 mt-8",children:[(0,s.jsx)(m.Ct,{tone:"yellow",children:"ØªÙØ¬Ù"}),(0,s.jsx)("span",{className:"text-11 leading-18 text-gray-6C6A7D",children:e})]},a)),(0,s.jsx)("p",{className:"mt-10 text-11 leading-18 text-gray-9B9BAA",children:"Ù
Ø¨ÙØº اجار٠از ÙØ±Ø® شبâÙØ§Û بازÙâÛ Ø¬Ø¯ÛØ¯ در تÙÙÛÙ
Ø¯ÙØ¨Ø§Ø±Ù ØØ³Ø§Ø¨ Ù
ÛâØ´ÙØ¯ ٠شبâÙØ§Û ÙØ¨ÙÛ Ø¯Ø± تÙÙÛÙ
آزاد Ù
ÛâØ´ÙÙØ¯."})]}),(0,s.jsx)("textarea",{value:j,onChange:e=>y(e.target.value),rows:2,placeholder:"ØªÙØ¶ÛØ â ÚØ±Ø§ اÛÙ Ø§ÙØ§Ù
ت جابÙâØ¬Ø§ Ù
ÛâØ´ÙØ¯Ø",className:"w-full rounded-10 border border-gray-E5E5E6 p-12 text-13 leading-22 outline-none focus:border-primary-main"}),(0,s.jsx)("p",{className:"mt-4 text-11 leading-18 text-gray-9B9BAA",children:"با ÙØ§Ù
Ø´Ù
ا در ØªØ§Ø±ÛØ®ÚÙâÛ Ø±Ø²Ø±Ù Ø«Ø¨Øª Ù
ÛâØ´ÙØ¯."}),A&&(0,s.jsx)("p",{className:"mt-10 text-13 text-[#C62828]",children:A}),(0,s.jsxs)("div",{className:"flex justify-end gap-x-8 mt-16",children:[(0,s.jsx)(m.zx,{variant:"secondary",onClick:r,children:"Ø§ÙØµØ±Ø§Ù"}),N?(0,s.jsx)(m.zx,{disabled:v||F||j.trim().length<3,onClick:()=>B(!1),children:v?"در ØØ§Ù Ø°Ø®ÛØ±Ù...":"Ø°Ø®ÛØ±Ù"}):(0,s.jsx)(m.zx,{disabled:v||!D||!x||k,onClick:()=>B(!0),children:v?"...":"Ù
ØØ§Ø³Ø¨ÙâÛ ØªØºÛÛØ±"})]})]})}function K(e){let{label:a,value:t,min:l,max:n,onChange:r}=e;return(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"block mb-6 text-12 leading-18 text-gray-6C6A7D font-m",children:a}),(0,s.jsxs)("div",{className:"flex items-center gap-x-8",children:[(0,s.jsx)("button",{type:"button",onClick:()=>r(Math.max(t-1,l)),className:"w-36 h-36 shrink-0 rounded-10 border border-gray-E5E5E6 text-16 text-gray-6C6A7D hover:border-gray-C4CAD3 transition",children:"â"}),(0,s.jsx)("span",{className:"flex-1 text-center text-14 leading-22 font-m text-black",children:(0,m.N)(t)}),(0,s.jsx)("button",{type:"button",disabled:void 0!==n&&t>=n,onClick:()=>r(t+1),className:"w-36 h-36 shrink-0 rounded-10 border border-gray-E5E5E6 text-16 text-gray-6C6A7D hover:border-gray-C4CAD3 transition disabled:opacity-40",children:"+"})]})]})}function q(e){let{label:a,a:t,b:l}=e;return(0,s.jsxs)("div",{className:"flex items-baseline justify-between gap-x-10 py-2 text-12 leading-20",children:[(0,s.jsx)("span",{className:"text-gray-6C6A7D",children:a}),(0,s.jsxs)("span",{className:"whitespace-nowrap",children:[(0,s.jsx)("span",{className:"text-gray-9B9BAA",children:(0,m.ND)(Math.round(t))})," â ",(0,s.jsx)("b",{className:`font-m ${Math.abs(t-l)>=1?l>t?"text-[#2E7D32]":"text-[#C62828]":"text-gray-9B9BAA"}`,children:(0,m.ND)(Math.round(l))})]})]})}let Q={DRAFT:"در Ø§ÙØªØ¸Ø§Ø± ثبت Ø¯Ø±Ø®ÙØ§Ø³Øª",HOST_APPROVAL:"در Ø§ÙØªØ¸Ø§Ø± تاÛÛØ¯ Ù
ÛØ²Ø¨Ø§Ù",SECOND_PAYMENT:"در Ø§ÙØªØ¸Ø§Ø± پرداخت ÙÙØ§ÛÛ",DONE:"تکÙ
Û٠شدÙ",CANCEL:"ÙØºÙ شدÙ",EXPIRED:"Ù
ÙÙØ¶Û شدÙ"},ee={DRAFT:"gray",HOST_APPROVAL:"yellow",SECOND_PAYMENT:"yellow",DONE:"green",CANCEL:"red",EXPIRED:"gray"},ea={HOST_CANCELLED:"Ù
ÛØ²Ø¨Ø§Ù",LIDOMA_CANCELLED:"Ù¾Ø´ØªÛØ¨Ø§ÙÛ ÙÛØ¯ÙÙ
ا",GUEST_CANCELLED:"Ù
ÙÙ
اÙ"},et={BOOMGARDI:"بÙÙ
âگردÛ",SUIT:"Ø³ÙØ¦Ûت"},es={CONFIRMED:"کارت Ù
ÙÛ â ØªØ§ÛÛØ¯ شدÙ",CHECKING:"کارت Ù
ÙÛ â Ø¯Ø± ØØ§Ù بررسÛ",NOT_CONFIRMED:"ثبت ÙØ´Ø¯Ù"},el={DRAFT:{to:"HOST_APPROVAL",approve:"ارسا٠ب٠Ù
ÛØ²Ø¨Ø§Ù",reject:"رد Ø¯Ø±Ø®ÙØ§Ø³Øª",deadline:"Ù
ÙÙØª ثبت Ø¯Ø±Ø®ÙØ§Ø³Øª"},HOST_APPROVAL:{to:"SECOND_PAYMENT",approve:"تاÛÛØ¯ Ø¯Ø±Ø®ÙØ§Ø³Øª",reject:"رد Ø¯Ø±Ø®ÙØ§Ø³Øª",deadline:"Ù
ÙÙØª تاÛÛØ¯ ÛØ§ رد"},SECOND_PAYMENT:{to:"DONE",approve:"ثبت پرداخت Ù
ÙÙ
اÙ",reject:"ÙØºÙ رزرÙ",deadline:"Ù
ÙÙØª پرداخت Ù
ÙÙ
اÙ"}};function en(){var e;let a=(0,i.useRouter)(),t=a.query.id,[n,u]=(0,l.useState)(!1),[h,g]=(0,l.useState)(!1),[b,y]=(0,l.useState)(!1),[v,C]=(0,l.useState)(!1),[A,E]=(0,l.useState)(!1),[S,D]=(0,l.useState)(!1),[k,B]=(0,l.useState)(0),{data:_,mutate:$,isLoading:T}=(0,d.u)(t?`/api/admin/reservations/${t}`:null,e=>(0,o.SC)(e)),P=!!_&&"CANCEL"!==_.state&&"EXPIRED"!==_.state,M=(0,x.o)("reservations",t);return(0,s.jsxs)(c.Z,{title:(null==_?void 0:_.reference)??"Ø¬Ø²Ø¦ÛØ§Øª رزرÙ",breadcrumb:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r(),{href:"/admin",children:"Ø¯Ø§Ø´Ø¨ÙØ±Ø¯"})," / ",(0,s.jsx)(r(),{href:"/admin/reservations",children:"رزرÙÙØ§"})]}),backHref:(null==M?void 0:M.returnUrl)??"/admin/reservations",prevNext:M?{prevHref:M.prevId?`/admin/reservations/${M.prevId}`:null,nextHref:M.nextId?`/admin/reservations/${M.nextId}`:null,position:`${(0,m.N)(M.index+1)} از ${(0,m.N)(M.total)}`}:void 0,actions:_&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(m.zx,{className:"bg-[#2E7D32] text-white hover:opacity-90",onClick:()=>er("payments"),children:[(0,s.jsx)("i",{className:"icon-Cash text-16"})," ثبت پرداخت"]}),(0,s.jsxs)(m.zx,{className:"bg-[#1B4F9C] text-white hover:opacity-90",onClick:()=>er("activity"),children:[(0,s.jsx)("i",{className:"icon-PhoneFill text-16"})," تÙ
اس Ù ÛØ§Ø¯Ø¯Ø§Ø´Øª"]}),(0,s.jsxs)(m.zx,{variant:"secondary",onClick:()=>g(!0),children:[(0,s.jsx)("i",{className:"icon-CalendarFlash text-16"})," تÙÙÛÙ
Ù ÙØ±Ø®"]}),(0,s.jsx)("a",{href:`/admin/reservations/${_.id}/invoice`,target:"_blank",rel:"noreferrer",children:(0,s.jsxs)(m.zx,{variant:"secondary",children:[(0,s.jsx)("i",{className:"icon-Details text-16"})," ÚØ§Ù¾ ÙØ§Ú©ØªÙر"]})}),(0,s.jsx)(N,{reservationId:_.id,onActed:()=>B(e=>e+1)}),P&&(0,s.jsx)(m.zx,{variant:"danger",onClick:()=>u(!0),children:"ÙØºÙ رزرÙ"})]}),children:[T&&(0,s.jsxs)("div",{className:"flex flex-col gap-16",children:[(0,s.jsx)(m.Od,{className:"h-[64px]"}),(0,s.jsx)(m.Od,{className:"h-[420px]"})]}),_&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(p,{reservationId:_.id,reference:_.reference,open:n,onClose:()=>u(!1),onCancelled:()=>$()}),(0,s.jsx)(m.u_,{open:h,onClose:()=>g(!1),title:`تÙÙÛÙ
Ù ÙØ±Ø® â ${_.residence.name}`,width:"max-w-[1280px]",children:(0,s.jsx)(F.Z,{targets:_.rooms.length>0?_.rooms.map(e=>({residenceId:_.residence.id,roomId:e.room.id,label:e.room.name})):[{residenceId:_.residence.id,label:_.residence.name}],onApplied:()=>{$(),B(e=>e+1)},footerRight:(0,s.jsx)("button",{type:"button",onClick:()=>{g(!1),y(!0)},className:"text-11 leading-18 font-m text-primary-dark whitespace-nowrap",children:"Ù
ÛâØ®ÙØ§ÙÛØ¯ ÙÙØ· ÙÛÙ
ت ÙÙ
ÛÙ Ø±Ø²Ø±Ù Ø¹ÙØ¶ Ø´ÙØ¯Ø"})})}),(0,s.jsx)(w,{open:b,onClose:()=>y(!1),reservationId:_.id,reference:_.reference,residenceId:_.residence.id,startDate:_.startDate,endD
1ate:_.endDate,onSaved:()=>{$(),B(e=>e+1)}}),(0,s.jsx)(Y,{open:A,onClose:()=>E(!1),reservationId:_.id,invoice:_.invoice,onSaved:()=>{$(),B(e=>e+1)}}),(0,s.jsx)(L,{open:v,onClose:()=>C(!1),reservationId:_.id,terms:{totalAmount:_.totalAmount,websiteShare:_.websiteShare,vatAmount:_.vatAmount,guestCommission:_.guestCommission,hostShare:_.hostShare},onSaved:()=>{$(),B(e=>e+1)}}),(0,s.jsx)(W,{open:S,onClose:()=>D(!1),reservationId:_.id,stay:{startDate:_.startDate,endDate:_.endDate,daysCount:_.daysCount,guestsCount:_.guestsCount,extraGuestsCount:_.extraGuestsCount,capacity:_.residence.capacity,maxCapacity:_.residence.maxCapacity},onSaved:()=>{$(),B(e=>e+1)}}),(0,s.jsxs)("div",{className:"flex flex-col gap-y-16",children:[(0,s.jsx)(j.Z,{reservationId:_.id,createdAt:_.createdAt,updatedAt:_.updatedAt,onCancel:()=>u(!0),onChanged:()=>{$(),B(e=>e+1)}}),(0,s.jsxs)("div",{className:"grid lg:grid-cols-12 gap-16 items-start",children:[(0,s.jsxs)("div",{className:"lg:col-span-5 flex flex-col gap-y-16 min-w-0",children:[(0,s.jsx)(ex,{data:_,onEditStay:()=>D(!0)}),(0,s.jsx)(em,{data:_}),(0,s.jsx)(eu,{data:_})]}),(0,s.jsx)("div",{className:"lg:col-span-4 min-w-0",children:(0,s.jsx)(eh,{data:_,onEditRates:()=>g(!0),onEditTerms:()=>C(!0),onEditGift:()=>E(!0)})}),(0,s.jsxs)("div",{className:"lg:col-span-3 flex flex-col gap-y-16 min-w-0",children:[(0,s.jsx)(ej,{data:_,onChanged:()=>$(),onReject:()=>u(!0)}),(0,s.jsx)(eb,{conversation:_.conversation})]})]}),(0,s.jsx)(Z,{invoice:_.invoice}),(0,s.jsx)("div",{id:"payments",children:(0,s.jsx)(O,{reservationId:_.id,canRecord:"CANCEL"!==_.state,guestWalletBalance:null===(e=_.guestProfile)||void 0===e?void 0:e.walletBalance,onChanged:()=>{$(),B(e=>e+1)}})}),(0,s.jsx)("div",{id:"activity",children:(0,s.jsx)(f.Z,{reservationId:_.id,refreshKey:k})}),"CANCEL"===_.state&&(0,s.jsxs)(m.Zb,{className:"p-20 border-r-4 border-r-[#E53935]",children:[(0,s.jsx)("h3",{className:"text-16 leading-24 font-m text-black mb-10",children:"Ø§Ø·ÙØ§Ø¹Ø§Øª ÙØºÙ"}),(0,s.jsxs)("div",{className:"grid md:grid-cols-2 gap-x-24",children:[(0,s.jsx)(ei,{label:"ÙØºÙÚ©ÙÙØ¯Ù",value:(_.cancelledBy&&ea[_.cancelledBy])??"â"}),(0,s.jsx)(ei,{label:"دÙÛÙ",value:_.cancelReason||"â"})]}),_.cancelDesc&&(0,s.jsx)("p",{className:"mt-12 rounded-10 bg-gray-F7F7F7 p-12 text-13 leading-22 text-gray-6C6A7D whitespace-pre-wrap",children:_.cancelDesc})]}),_.review&&(0,s.jsx)(ey,{review:_.review})]})]})]})}function er(e){requestAnimationFrame(()=>{let a=document.getElementById(e);if(!a)return;let t=a.getBoundingClientRect().top+window.scrollY-76;window.scrollTo({top:Math.max(t,0)})})}function ei(e){let{label:a,value:t,nowrap:l}=e;return(0,s.jsxs)("div",{className:"flex items-baseline gap-x-8 py-4 text-13 leading-22",children:[(0,s.jsxs)("span",{className:"text-gray-9B9BAA shrink-0",children:[a," :"]}),(0,s.jsx)("span",{className:`text-black min-w-0 ${l?"whitespace-nowrap":"break-words"}`,children:t})]})}function ed(e){let{icon:a,children:t}=e;return(0,s.jsxs)("div",{className:"flex items-center gap-x-8 mb-12",children:[(0,s.jsx)("i",{className:`${a} text-16 text-gray-9B9BAA`}),(0,s.jsx)("h3",{className:"text-15 leading-24 font-m text-black",children:t})]})}function ec(e){let{value:a}=e,[t,n]=(0,l.useState)(!1);return(0,s.jsxs)("span",{className:"inline-flex items-center gap-x-6",children:[(0,s.jsx)("a",{href:`tel:${a}`,dir:"ltr",className:"text-13 leading-22 text-black hover:text-primary-main",children:a}),(0,s.jsx)("button",{type:"button",title:"Ú©Ù¾Û Ø´Ù
ارÙ",onClick:()=>{var e;
1null===(e=navigator.clipboard)||void 0===e||e.writeText(a).then(()=>{n(!0),setTimeout(()=>n(!1),1400)},()=>void 0)},className:`px-6 py-2 rounded-6 text-10 leading-16 border transition ${t?"border-[#03D6BB] text-[#015046] bg-[#03D6BB14]":"border-gray-E5E5E6 text-gray-9B9BAA hover:border-gray-C4CAD3"}`,children:t?"Ú©Ù¾Û Ø´Ø¯":"Ú©Ù¾Û"})]})}function eo(e){let{url:a,name:t,size:l=44}=e;return(0,s.jsx)("span",{className:"rounded-full bg-gray-F0F0F0 overflow-hidden shrink-0 flex items-center justify-center text-14 text-gray-6C6A7D",style:{width:l,height:l},children:a?(0,s.jsx)("img",{src:(0,m.vD)(a,96),alt:"",className:"w-full h-full object-cover"}):(null==t?void 0:t[0])??"Ø"})}function ex(e){let{data:a,onEditStay:t}=e,l=a.guestProfile;return(0,s.jsxs)(m.Zb,{className:"p-20",children:[(0,s.jsx)(ed,{icon:"icon-Profile",children:"Ù
شخصات Ù
ÙÙ
اÙ"}),(0,s.jsxs)("div",{className:"flex items-center gap-x-12 mb-12",children:[(0,s.jsx)(eo,{url:a.guest.avatarUrl,name:a.guest.name}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"flex items-center gap-x-8 flex-wrap gap-y-6",children:[(0,s.jsx)(r(),{href:`/admin/users/${a.guest.id}`,className:"text-14 leading-22 font-m text-primary-dark hover:text-primary-main truncate",children:a.guest.name||"بدÙÙ ÙØ§Ù
"}),(null==l?void 0:l.isSpecialHost)&&(0,s.jsx)(m.Ct,{tone:"yellow",children:"Ù
ÙÙ
ا٠ÙÛÚÙ"})]}),(0,s.jsxs)("div",{className:"mt-2",children:[(0,s.jsx)("span",{className:"text-12 text-gray-9B9BAA",children:"Ø´Ù
ار٠تÙ
اس "}),(0,s.jsx)(ec,{value:a.guestPhoneOverride||a.guest.phone})]})]})]}),(0,s.jsxs)("div",{className:"grid md:grid-cols-2 gap-x-20",children:[(0,s.jsxs)("div",{className:"flex items-center gap-x-6",children:[(0,s.jsx)(ei,{nowrap:!0,label:"ØªØ§Ø±ÛØ® Ø³ÙØ±",value:`${(0,_.R3)(a.startDate)} â ${(0,_.R3)(a.endDate)}`}),(0,s.jsx)("button",{type:"button",onClick:t,title:"ÙÛØ±Ø§ÛØ´ Ø§ÙØ§Ù
ت",className:"shrink-0 text-gray-9B9BAA hover:text-primary-main transition",children:(0,s.jsx)("i",{className:"icon-Edit text-16"})})]}),(0,s.jsx)(ei,{nowrap:!0,label:"Ù
دت Ø§ÙØ§Ù
ت",value:`${(0,m.N)(a.daysCount)} شب`}),(0,s.jsx)(ei,{nowrap:!0,label:"تعداد Ù
ÙÙ
Ø§ÙØ§Ù",value:`${(0,m.N)(a.guestsCount)} ÙÙØ±${a.extraGuestsCount>0?` + ${(0,m.N)(a.extraGuestsCount)} ÙÙØ± اضاÙÙ`:""}`}),(0,s.jsx)(ei,{nowrap:!0,label:"Ù
ÙØ¬ÙØ¯Û Ú©ÛÙ Ù¾ÙÙ",value:l?(0,m.ND)(l.walletBalance):"â"})]}),a.guestNameOverride&&(0,s.jsxs)("p",{className:"mt-8 text-11 leading-18 text-gray-9B9BAA",children:["Ø±Ø²Ø±Ù Ø¨Ø±Ø§Û Ø´Ø®Øµ دÛگر: ",a.guestNameOverride]})]})}function em(e){var a,t,l,n;let{data:i}=e,d=i.residence,c=[null===(a=d.city)||void 0===a?void 0:a.name,null===(t=d.city)||void 0===t?void 0:null===(l=t.province)||void 0===l?void 0:l.name,d.neighborhood].filter(Boolean).join("Ø ");return(0,s.jsxs)(m.Zb,{className:"p-20",children:[(0,s.jsx)(ed,{icon:"icon-Homes",children:"Ù
شخصات Ø§ÙØ§Ù
تگاÙ"}),(0,s.jsxs)("div",{className:"flex gap-x-14",children:[(null===(n=d.images[0])||void 0===n?void 0:n.url)?(0,s.jsx)("img",{src:(0,m.vD)(d.images[0].url,384),alt:"",className:"w-[104px] h-[78px] rounded-12 object-cover shrink-0"}):(0,s.jsx)("span",{className:"w-[104px] h-[78px] rounded-12 bg-gray-F0F0F0 shrink-0"}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"flex items-center gap-x-8 flex-wrap gap-y-4",children:[(0,s.jsx)(r(),{href:`/admin/residences/${d.publicId??d.id}`,className:"text-14 leading-22 font-m text-primary-dark hover:text-primary-main",children:d.name}),(0,s.jsxs)("span",{className:"text-12 text-gray-9B9BAA",children:["( کد : ",d.reference," )"]}),(0,s.jsx)(m.Ct,{tone:"gray",children:et[d.type]??d.type})]}),(0,s.jsxs)("p",{className:"flex items-start gap-x-6 text-12 leading-20 text-gray-6C6A7D mt-4",children:[(0,s.jsx)("i",{className:"icon-Home text-14 text-gray-9B9BAA shrink-0 mt-2"}),(0,s.jsx)("span",{children:[c,d.address].filter(Boolean).join("Ø ")||"â"})]}),(0,s.jsx)("div",{className:"mt-6",children:(0,s.jsx)(m.tS,{value:d.averageRating,count:d.reviewsCount})})]})]}),(0,s.jsxs)("div",{className:"grid md:grid-cols-2 gap-x-20 mt-12",children:[(0,s.jsx)(ei,{nowrap:!0,label:"ÙØ±Ùد",value:`${d.checkinFrom??"â"} تا ${d.checkinTo??"â"}`}),(0,s.jsx)(ei,{nowrap:!0,label:"Ø®Ø±ÙØ¬",value:d.checkout??"â"})]}),i.rooms.length>0&&(0,s.jsxs)("p",{className:"mt-8 text-12 leading-20 text-gray-6C6A7D",children:["اتاÙâÙØ§Û Ø±Ø²Ø±ÙØ´Ø¯Ù: ",i.rooms.map(e=>e.room.name).join("Ø ")]}),d.rules.length>0&&(0,s.jsxs)("p",{className:"mt-4 text-11 leading-18 text-gray-9B9BAA",children:["ÙÙ
1اÙÛÙ: ",d.rules.map(e=>e.rule.name).join("Ø ")]})]})}function eu(e){let{data:a}=e,t=a.hostProfile;return(0,s.jsxs)(m.Zb,{className:"p-20",children:[(0,s.jsx)(ed,{icon:"icon-Profile",children:"Ù
شخصات Ù
ÛØ²Ø¨Ø§Ù"}),(0,s.jsxs)("div",{className:"flex items-center gap-x-12",children:[(0,s.jsx)(eo,{url:a.host.avatarUrl,name:a.host.name}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"flex items-center gap-x-8 flex-wrap gap-y-6",children:[(0,s.jsx)(r(),{href:`/admin/users/${a.host.id}`,className:"text-14 leading-22 font-m text-primary-dark hover:text-primary-main truncate",children:a.host.name||"بدÙÙ ÙØ§Ù
"}),(null==t?void 0:t.isSpecialHost)&&(0,s.jsx)(m.Ct,{tone:"blue",children:"Ù
ÛØ²Ø¨Ø§Ù ÙÛÚÙ"})]}),(0,s.jsxs)("div",{className:"mt-2",children:[(0,s.jsx)("span",{className:"text-12 text-gray-9B9BAA",children:"Ø´Ù
ار٠تÙ
اس "}),(0,s.jsx)(ec,{value:a.host.phone})]})]})]}),(0,s.jsxs)("div",{className:"grid md:grid-cols-2 gap-x-20 mt-10",children:[(0,s.jsx)(ei,{nowrap:!0,label:"کارÙ
زد Ø³Ø§ÛØª",value:null!=a.commissionPercent?`${(0,m.N)(a.commissionPercent)}Ùª از اÛ٠رزرÙ`:"â"}),(0,s.jsx)(ei,{nowrap:!0,label:"Ù
ÙØ¬ÙØ¯Û Ú©ÛÙ Ù¾ÙÙ",value:t?(0,m.ND)(t.walletBalance):"â"}),(0,s.jsx)(ei,{label:"Ù
دارک",value:t?es[t.verificationStatus]??"â":"â"}),(0,s.jsx)(ei,{nowrap:!0,label:"تعداد Ø§ÙØ§Ù
تگاÙ",value:(null==t?void 0:t.residencesCount)!==void 0?`${(0,m.N)(t.residencesCount)} Ø§ÙØ§Ù
تگاÙ`:"â"})]})]})}function eh(e){let{data:a,onEditRates:t,onEditTerms:l,onEditGift:n}=e,r=a.invoice,i=(a.hostShare??0)-a.settledAmount,d=e=>null!=e?`${(0,m.N)(e)}Ùª`:void 0;return(0,s.jsxs)(m.Zb,{className:"p-20",children:[(0,s.jsxs)("div",{className:"rounded-12 border border-gray-E5E5E6 py-12 text-center mb-14",children:[(0,s.jsx)("span",{className:"text-13 leading-22 text-gray-6C6A7D",children:"کد رزر٠"}),(0,s.jsx)("b",{className:"text-15 leading-24 font-m text-black tracking-wide",children:a.reference})]}),(0,s.jsxs)("div",{className:"rounded-12 bg-gray-F7F7F7 p-14 mb-14 text-center",children:[(0,s.jsx)("p",{className:"text-12 leading-20 text-gray-6C6A7D mb-2",children:"Ù
Ø¨ÙØº ÙÙØ§ÛÛ ÙØ§Ø¨Ù پرداخت Ù
ÙÙ
اÙ"}),(0,s.jsx)("strong",{className:"text-18 leading-28 font-m text-black",children:(0,m.ND)(r.guestPayable)})]}),(0,s.jsx)(ep,{label:"Ù
Ø¨ÙØº ک٠رزرÙ",value:r.totalAmount}),r.codeDiscount>0&&(0,s.jsx)(ep,{label:`کد تخÙÛÙ${r.discountCode?` (${r.discountCode})`:""}`,value:-r.codeDiscount,tone:"red"}),r.hostGiftDiscount>0&&(0,s.jsx)(ep,{label:"تخÙÛÙ ÙØ¯ÛÙ Ù
ÛØ²Ø¨Ø§Ù",value:-r.hostGiftDiscount,tone:"red"}),r.siteGiftDiscount>0&&(0,s.jsx)(ep,{label:"تخÙÛÙ ÙØ¯ÛÙ Ø³Ø§ÛØª",value:-r.siteGiftDiscount,tone:"red"}),r.totalDiscount>0&&(0,s.jsx)(ep,{label:"Ù
Ø¨ÙØº ÙÙØ§ÛÛ ØµÙØ±ØªØØ³Ø§Ø¨",value:r.invoiceAmount,strong:!0}),(0,s.jsx)(ep,{label:"کارÙ
زد رزر٠Ù
ÙÙ
اÙ",hint:d(r.guestCommissionPercent),value:r.guestCommission}),(0,s.jsx)(ep,{label:"Ù
Ø¨ÙØº ÙÙØ§ÛÛ ÙØ§Ø¨Ù پرداخت Ù
ÙÙ
اÙ",value:r.guestPayable,strong:!0}),(0,s.jsx)(ep,{label:"Ù¾Ø±Ø¯Ø§Ø®ØªÛ Ù
Ø³Ø§ÙØ±",value:a.paidAmount}),a.remainingAmount>0&&(0,s.jsx)(ep,{label:"باÙÛâÙ
Ø§ÙØ¯Ù پرداخت",value:a.remainingAmount,tone:"red",strong:!0}),(0,s.jsx)(eg,{}),(0,s.jsx)(ep,{label:"سÙÙ
ÙÛØ¯ÙÙ
ا",hint:d(r.commissionPercent),value:r.websiteShare}),(0,s.jsx)(ep,{label:"ارزش Ø§ÙØ²ÙدÙ",hint:null!=r.vatPercent?`${(0,m.N)(r.vatPercent)}Ùª از سÙÙ
ÙÛØ¯ÙÙ
ا`:void 0,value:r.vatAmount}),r.hostGiftDiscount>0?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ep,{label:"Ø¯Ø±ÛØ§ÙØªÛ Ù
ÛØ²Ø¨Ø§Ù Ù¾ÛØ´ از ÙØ¯ÛÙ",value:r.hostShareBeforeGift}),(0,s.jsx)(ep,{label:"تخÙÛÙ ÙØ¯ÛÙ Ù
ÛØ²Ø¨Ø§Ù",value:-r.hostGiftDiscount,tone:"red"})]}):null,(0,s.jsx)(ep,{label:"Ù
Ø¨ÙØº ÙÙØ§ÛÛ Ø¯Ø±ÛØ§Ùت Ù
ÛØ²Ø¨Ø§Ù",value:r.hostShare,strong:!0}),(0,s.jsx)(eg,{}),(0,s.jsx)(ep,{label:"ÙØ§Ø±Ûز شد٠ب٠Ù
ÛØ²Ø¨Ø§Ù",value:a.settledAmount}),(0,s.jsx)(ep,{label:"Ù
Ø§ÙØ¯Ù سÙÙ
Ù
ÛØ²Ø¨Ø§Ù",value:null==a.hostShare?null:i,strong:!0,tone:i>0?"red":"green"}),(null!=a.residence.hostShareTotalAmount||null!=a.residence.hostSharePastNights||null!=a.residence.hostShareFutureNights)&&(0,s.jsxs)("p",{className:"mt-10 text-11 leading-18 text-gray-9B9BAA",children:["Ø³ÛØ§Ø³Øª تسÙÛÙ: Ú©Ù ",a.residence.hostShareTotalAmount??"â","Ùª \xb7 شبâÙØ§Û گذشتÙ"," ",a.residence.hostSharePastNights??"â","Ùª \xb7 شبâÙØ§Û Ø¢ÛÙØ¯Ù"," ",a.residence.hostShareFutureNights??"â","Ùª"]}),(0,s.jsxs)("div",{className:"mt-14 flex flex-col gap-y-8",children:[(0,s.jsxs)(m.zx,{variant:"secondary",className:"w-full",onClick:t,children:[(0,s.jsx)("i",{className:"icon-Edit text-16"})," ÙÛØ±Ø§ÛØ´ ÙÛÙ
ت رزرÙ"]}),(0,s.jsxs)(m.zx,{variant:"secondary",className:"w-full",onClick:l,children:[(0,s.jsx)("i",{className:"icon-Cash text-16"})," ÙÛØ±Ø§ÛØ´ کارÙ
زد Ù Ù
اÙÛØ§Øª"]}),(0,s.jsxs)(m.zx,{variant:"secondary",className:"w-full",onClick:n,children:[(0,s.jsx)("i",{className:"icon-Offer text-16"})," تخÙÛÙ ÙØ¯ÛÙ"]})]})]})}function eg(){return(0,s.jsx)("div",{className:"h-1 bg-gray-F0F0F0 my-10"})}function ep(e){let{label:a,value:t,hint:l,strong:n,tone:r,text:i}=e;return(0,s.jsxs)("div",{className:"flex items-baseline justify-between gap-x-12 py-3",children:[(0,s.jsxs)("span",{className:"text-12 leading-20 text-gray-9B9BAA min-w-0",children:[a,l&&(0,s.jsxs)("span",{className:"text-11",children:[" \xb7 ",l]})]}),(0,s.jsx)("span",{className:`text-13 leading-20 whitespace-nowrap ${"red"===r?"text-[#C62828]":"green"===r?"text-[#2E7D32]":n?"text-black":"text-gray-6C6A7D"} ${n?"font-m":""}`,children:i??(null==t?(0,s.jsx)("span",{className:"text-gray-9B9BAA",children:"ثبت ÙØ´Ø¯Ù"}):(0,m.ND)(t))})]})}
1function eb(e){let{conversation:a}=e,t=null==a?void 0:a.lastMessage;return(0,s.jsxs)(m.Zb,{className:"p-16",children:[(0,s.jsx)("h3",{className:"text-13 leading-20 font-m text-black mb-8",children:"آخرÛÙ Ù¾ÛØ§Ù
Ú¯ÙØªÚ¯Ù"}),t?(0,s.jsxs)("div",{className:"mb-10",children:[(0,s.jsx)("span",{className:"text-11 leading-18 text-gray-9B9BAA",children:"GUEST"===t.senderRole?"Ù
ÙÙ
اÙ":"Ù
ÛØ²Ø¨Ø§Ù"}),(0,s.jsx)("p",{className:"mt-2 text-13 leading-22 text-black break-words",children:t.preview})]}):(0,s.jsx)("p",{className:"mb-10 text-12 leading-20 text-gray-9B9BAA",children:"Ú¯ÙØªÚ¯ÙÛÛ ÙØ¯Ø§Ø´ØªÙد"}),a&&(0,s.jsx)(r(),{href:`/admin/conversations?c=${a.id}`,children:(0,s.jsxs)(m.zx,{variant:"secondary",className:"w-full",children:[(0,s.jsx)("i",{className:"icon-message text-16"})," Ù
Ø´Ø§ÙØ¯Ù Ú¯ÙØªÚ¯Ù"]})})]})}function ej(e){let{data:a,onChanged:t,onReject:n}=e,[r,i]=(0,l.useState)(!1),[d,c]=(0,l.useState)(""),[x,u]=(0,l.useState)(!1),[h,g]=(0,l.useState)(null),[p,b]=(0,l.useState)(!1),[j,y]=(0,l.useState)(null),N=el[a.state],f=a.expiryDate?Math.round((new Date(a.expiryDate).getTime()-Date.now())/6e4):null,v=null!=f&&f<=0;async function C(){N&&(await (0,o.SC)(`/api/admin/reservations/${a.id}/state`,{method:"POST",body:JSON.stringify({toState:N.to,note:d.trim()})}),i(!1),y(null),c(""),t())}async function A(){if(N){u(!0),g(null);try{if("DONE"===N.to){let e=await (0,o.SC)(`/api/admin/reservations/${a.id}/payments`);if(e.summary.remaining>0){i(!1),y(e.summary.remaining);return}}await C()}catch(e){g(e instanceof Error?e.message:"ثبت ÙØ´Ø¯")}finally{u(!1)}}}async function E(){u(!0),g(null);try{await C()}catch(e){g(e instanceof Error?e.message:"ثبت ÙØ´Ø¯")}finally{u(!1)}}async function w(e){u(!0),g(null);try{await (0,o.SC)(`/api/admin/reservations/${a.id}/expiry`,{method:"PATCH",body:JSON.stringify({minutesFromNow:e})}),b(!1),t()}catch(e){g(e instanceof Error?e.message:"تÙ
Ø¯ÛØ¯ ÙØ´Ø¯")}finally{u(!1)}}let S=(0,s.jsxs)(m.u_,{open:null!=j,onClose:()=>y(null),title:"Ù
ÙÙ
ا٠ÙÙÙØ² پرداخت را کاÙ
Ù ÙکردÙ",width:"max-w-[460px]",children:[(0,s.jsxs)("p",{className:"text-13 leading-22 text-gray-6C6A7D mb-4",children:["Ø·Ø¨Ù Ø¯ÙØªØ± پرداختâÙØ§Ø ÙÙÙØ²"," ",(0,s.jsx)("b",{className:"text-[#C62828]",children:null!=j&&(0,m.ND)(j)})," از Ù
ÙÙ
Ø§Ù Ø¯Ø±ÛØ§Ùت ÙØ´Ø¯Ù است. رزر٠",(0,s.jsx)("b",{className:"text-black",children:a.reference})," ÙÙÙØ² \xabÙØ·Ø¹Û\xbb ÙØ´Ø¯Ù â Ø§Û٠تصÙ
ÛÙ
Ø´Ù
است."]}),(0,s.jsx)("p",{className:"text-12 leading-20 text-gray-9B9BAA mb-16",children:"Ù
ÛâØªÙØ§ÙÛØ¯ ÙÙ
ÛÙ ØØ§Ùا برÙÛØ¯ ٠پرداخت را ثبت Ú©ÙÛØ¯ â Ø±Ø²Ø±Ù تا آ٠زÙ
ا٠ب٠ÙÙ
ÛÙ ØØ§Ùت Ù
ÛâÙ
Ø§ÙØ¯ â ÛØ§ بدÙÙ Ø¯Ø±ÛØ§Ùت اÛÙ Ù
Ø¨ÙØº رزر٠را ÙÙ
ÛÙ Ø§ÙØ§Ù ÙØ·Ø¹Û Ú©ÙÛØ¯."}),(0,s.jsxs)("div",{className:"flex flex-col gap-y-8",children:[(0,s.jsx)(m.zx,{className:"w-full",disabled:x,onClick:()=>{var e;y(null),null===(e=document.getElementById("payments"))||void 0===e||e.scrollIntoView({behavior:"smooth",block:"start"})},children:"ثبت پرداخت Ù
ÙÙ
اÙ"}),(0,s.jsx)(m.zx,{variant:"ghost",className:"w-full",disabled:x,onClick:E,children:x?"در ØØ§Ù ثبت...":"اداÙ
Ù Ù ÙØ·Ø¹Ûâکرد٠رزر٠بدÙ٠پرداخت Ù
ÙÙ
اÙ"})]}),h&&(0,s.jsx)("p",{className:"mt-10 text-13 text-[#C62828]",children:h})]});return N?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(m.Zb,{className:"p-20",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-y-10",children:[(0,s.jsx)(m.zx,{className:"w-full bg-[#2E7D32] text-white hover:opacity-90",onClick:()=>i(!0),children:N.approve}),(0,s.jsx)(m.zx,{variant:"danger",className:"w-full",onClick:n,children:N.reject})]}),(0,s.jsxs)("div",{className:"mt-16 pt-14 border-t border-gray-F0F0F0",children:[(0,s.jsx)("p",{className:"text-12 leading-20 text-gray-6C6A7D mb-6",children:N.deadline}),a.expiryDate?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:`text-24 leading-32 font-m tracking-wide ${v?"text-[#C62828]":"text-black"}`,dir:"ltr",children:v?"Û°Û° : Û°Û°":function(e){let a=e=>(0,m.N)(e).padStart(2,"Û°");return`${a(Math.floor(e/60))} : ${a(e%60)}`}(f)}),(0,s.jsxs)("p",{className:"text-11 leading-18 text-gray-9B9BAA mt-2",children:[(0,_.R3)(a.expiryDate)," ساعت ",(0,m.A1)(a.expiryDate)[1],v&&" â Ú¯Ø°Ø´ØªÙØ در Ø§Ø¬Ø±Ø§Û Ø¨Ø¹Ø¯Û Ø²Ù
اÙâØ¨ÙØ¯ Ù
ÙÙØ¶Û Ù
ÛâØ´ÙØ¯"]})]}):(0,s.jsx)("p",{className:"text-12 leading-20 text-gray-9B9BAA",children:"Ù
ÙÙØªÛ ثبت ÙØ´Ø¯Ù â Ø§ÛÙ Ø±Ø²Ø±Ù Ø®ÙØ¯Ø¨ÙâØ®ÙØ¯ Ù
ÙÙØ¶Û ÙÙ
ÛâØ´ÙØ¯."}),p?(0,s.jsxs)("div",{className:"mt-10 flex flex-wrap gap-8",children:[[30,60,120,720].map(e=>(0,s.jsx)("button",{type:"button",disabled:x,onClick:()=>w(e),className:"px-10 py-6 rounded-10 text-12 leading-20 border border-gray-E5E5E6 text-gray-6C6A7D hover:border-gray-C4CAD3 transition disabled:opacity-50",children:e<60?`${(0,m.N)(e)} دÙÛÙÙ`:`${(0,m.N)(e/60)} ساعت`},e)),(0,s.jsx)("button",{type:"button",onClick:()=>b(!1),className:"px-10 py-6 rounded-10 text-12 leading-20 text-gray-9B9BAA",children:"Ø§ÙØµØ±Ø§Ù"})]}):(0,s.jsxs)(m.zx,{variant:"secondary",className:"w-full mt-10",onClick:()=>b(!0),children:["تÙ
Ø¯ÛØ¯ ",N.deadline]})]}),h&&(0,s.jsx)("p",{className:"mt-10 text-13 text-[#C62828]",children:h}),(0,s.jsxs)(m.u_,{open:r,onClose:()=>i(!1),title:N.approve,width:"max-w-[460px]",children:[(0,s.jsxs)("p",{className:"text-13 leading-22 text-gray-6C6A7D mb-10",children:["رزر٠",(0,s.jsx)("b",{className:"text-black",children:a.reference})," Ø¨Ù ÙØ¶Ø¹Ûت \xab",Q[N.to],"\xbb Ù
ÙØªÙÙ Ù
ÛâØ´ÙØ¯."]}),(0,s.jsx)("textarea",{value:d,onChange:e=>c(e.target.value),rows:3,placeholder:"ØªÙØ¶ÛØ â ÚØ±Ø§ اÛ٠رزر٠جابÙâØ¬Ø§ Ù
ÛâØ´ÙØ¯Ø",className:"w-full rounded-8 border border-gray-E5E5E6 p-10 text-13 leading-22 outline-none focus:border-primary-main"}),(0,s.jsx)("p",{className:"mt-6 text-11 leading-18 text-gray-9B9BAA",children:"اÛÙ ØªÙØ¶ÛØ Ø¯Ø± ØªØ§Ø±ÛØ®ÚÙâÛ Ø±Ø²Ø±Ù Ø¨Ø§ ÙØ§Ù
Ø´Ù
ا ثبت Ù
ÛâØ´ÙØ¯ ٠پاک ÙÙ
ÛâØ´ÙØ¯."}),h&&(0,s.jsx)("p",{className:"mt-8 text-13 text-[#C62828]",children:h}),(0,s.jsxs)("div",{className:"flex justify-end gap-x-8 mt-14",children:[(0,s.jsx)(m.zx,{variant:"secondary",onClick:()=>i(!1),children:"Ø§ÙØµØ±Ø§Ù"}),(0,s.jsx)(m.zx,{disabled:x||d.trim().length<3,onClick:A,children:x?"در ØØ§Ù ثبت...":"ثبت"})]})]})]}),S]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(m.Zb,{className:"p-20",children:[(0,s.jsx)("h3",{className:"text-15 leading-24 font-m text-black mb-8",children:"ÙØ¶Ø¹Ûت رزرÙ"}),(0,s.jsx)(m.Ct,{tone:ee[a.state]??"gray",children:Q[a.state]??a.state}),(0,s.jsx)("p",{className:"mt-10 text-12 leading-20 text-gray-6C6A7D",children:"تصÙ
ÛÙ
Û Ø¨Ø±Ø§Û Ø§Û٠رزر٠در Ø§ÙØªØ¸Ø§Ø± ÙÛØ³Øª. Ø¨Ø±Ø§Û Ø¬Ø§Ø¨ÙâØ¬Ø§ÛÛ Ø¯Ø³ØªÛ Ø§Ø² Ù¾ÙÙ \xabÙØ¶Ø¹Ûت رزرÙ\xbb پاÛÛÙ ØµÙØÙ Ø§Ø³ØªÙØ§Ø¯Ù Ú©ÙÛØ¯."})]}),S]})}function ey(e){let{review:a}=e,t=[{label:"ÙØ¸Ø§Ùت",score:a.cleaning},{label:"Ù
ÙÙØ¹Ûت Ù
کاÙÛ",score:a.location},{label:"Ú©ÛÙÛØª ÙØ³Ø¨Øª Ø¨Ù ÙØ±Ø®",score:a.quality},{label:"ØµØØª Ù
Ø·Ø§ÙØ¨",score:a.integrity},{label:"Ø¨Ø±Ø®ÙØ±Ø¯ Ù
ÛØ²Ø¨Ø§Ù",score:a.greeting},{label:"ÙØÙ٠تØÙÛÙ",score:a.delivery}];return(0,s.jsxs)(m.Zb,{className:"p-20",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-x-12 flex-wrap gap-y-8 mb-10",children:[(0,s.jsx)("h3",{className:"text-16 leading-24 font-m text-black",children:"ÙØ¸Ø± Ù
ÙÙ
اÙ"}),(0,s.jsx)(m.tS,{value:a.averageRating})]}),(0,s.jsx)("p",{className:"text-13 leading-22 text-black whitespace-pre-wrap",children:a.comment}),(0,s.jsx)("div",{className:"grid md:grid-cols-3 gap-x-24 mt-12",children:t.map(e=>(0,s.jsx)(ei,{label:e.label,value:`${(0,m.N)(e.score)} از Ûµ`},e.label))}),a.hostAnswer&&(0,s.jsxs)("div",{className:"mt-12 rounded-10 bg-gray-F7F7F7 p-12",children:[(0,s.jsx)("p",{className:"text-11 leading-18 text-gray-9B9BAA mb-4",children:"پاسخ Ù
ÛØ²Ø¨Ø§Ù"}),(0,s.jsx)("p",{className:"text-13 leading-22 text-black whitespace-pre-wrap",children:a.hostAnswer})]})]})}}
1,35157:function(e,a,t){"use strict";t.d(a,{g:function(){return n},o:function(){return r}});var s=t(67294);let l="lidoma_admin_nav:";function n(e,a,t){try{let s={ids:a,returnUrl:t,savedAt:Date.now()};window.sessionStorage.setItem(l+e,JSON.stringify(s))}catch{}}function r(e,a){let[t,n]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(null==a){n(null);return}let t=function(e){try{let a=window.sessionStorage.getItem(l+e);if(!a)return null;let t=JSON.parse(a);if(Date.now()-t.savedAt>18e5)return null;return t}catch{return null}}(e);if(!t){n(null);return}let s=t.ids.findIndex(e=>String(e)===String(a));if(-1===s){n(null);return}n({index:s,total:t.ids.length,prevId:s>0?t.ids[s-1]:null,nextId:s<t.ids.length-1?t.ids[s+1]:null,returnUrl:t.returnUrl})},[e,a]),t}}},function(e){e.O(0,[4885,4389,8289,9759,3496,9774,2888,179],function(){return e(e.s=68552)}),_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.