PageSourceSearch

https://lidomatrip.com/_next/static/chunks/pages/admin/reservations/[id]-8da38b2ddba95669.js

js lidomatrip.com collected 2026-09-25 07:11:06 UTC 97,934 bytes, 1 lines download raw bytes

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