PageSourceSearch

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

js lidomatrip.com collected 2026-10-02 20:26:01 UTC 95,147 bytes, 1 lines download raw bytes

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.