1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3919],{17838:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/settings/discount-codes/[id]",function(){return t(59783)}])},55290:function(e,n,t){"use strict";t.d(n,{Em:function(){return m},R3:function(){return d},Y3:function(){return c},YS:function(){return u},ZP:function(){return x}});var s=t(10253),a=t(85893),i=t(67294),r=t(68289),l=t.n(r),c=["ÙØ±ÙردÛÙ","Ø§Ø±Ø¯ÛØ¨Ùشت","خرداد","ØªÛØ±","Ù
رداد","Ø´ÙØ±ÛÙØ±","Ù
ÙØ±","آباÙ","آذر","دÛ","بÙÙ
Ù","اسÙÙØ¯"],o=["Ø´","Û","د","س","Ú","Ù¾","ج"],u=function(e){return String(e).replace(/[0-9]/g,function(e){return"Û°Û±Û²Û³Û´ÛµÛ¶Û·Û¸Û¹"[Number(e)]})};function d(e){if(!e)return"â";var n=l()(e.slice(0,10),"YYYY-MM-DD");return n.isValid()?"".concat(u(n.format("jD"))," ").concat(c[n.jMonth()]," ").concat(u(n.jYear())):"â"}function m(e){if(!e)return"â";var n=l()(e.slice(0,10),"YYYY-MM-DD");return n.isValid()?u(n.format("jYYYY/jMM/jDD")):"â"}function x(e){var n=e.label,t=e.value,r=e.onChange,m=e.min,x=e.hint,h=(0,s.Z)((0,i.useState)(!1),2),g=h[0],p=h[1],v=(0,s.Z)((0,i.useState)(function(){return t?l()(t,"YYYY-MM-DD"):l()()}),2),f=v[0],b=v[1],j=(0,i.useRef)(null);(0,i.useEffect)(function(){g&&t&&b(l()(t,"YYYY-MM-DD"))},[g,t]),(0,i.useEffect)(function(){var e=function(e){var n;(null===(n=j.current)||void 0===n?void 0:n.contains(e.target))||p(!1)},n=function(e){"Escape"===e.key&&p(!1)};if(g)return document.addEventListener("mousedown",e),document.addEventListener("keydown",n),function(){document.removeEventListener("mousedown",e),document.removeEventListener("keydown",n)}},[g]);var N=(0,i.useMemo)(function(){var e=f.clone().startOf("jMonth");return Array.from({length:f.clone().endOf("jMonth").jDate()},function(n,t){return e.clone().add(t,"day")})},[f]),y=(f.clone().startOf("jMonth").day()+1)%7;return(0,a.jsxs)("div",{ref:j,className:"relative",children:[(0,a.jsx)("span",{className:"block mb-6 text-12 leading-18 text-gray-6C6A7D font-m",children:n}),(0,a.jsxs)("button",{type:"button",onClick:function(){return p(function(e){return!e})},className:"w-full flex items-center justify-between gap-x-8 px-14 py-10 rounded-10 border text-14 leading-22 text-right transition ".concat(g?"border-primary-main":"border-gray-E5E5E6 hover:border-gray-C4CAD3"),children:[(0,a.jsx)("span",{className:t?"text-black":"text-gray-9B9BAA",children:t?d(t):"Ø§ÙØªØ®Ø§Ø¨ ØªØ§Ø±ÛØ®"}),(0,a.jsx)("i",{className:"icon-Calendar text-16 text-gray-9B9BAA"})]}),x&&(0,a.jsx)("span",{className:"block mt-4 text-11 leading-18 text-gray-9B9BAA",children:x}),g&&(0,a.jsxs)("div",{className:"absolute z-5 mt-6 right-0 w-[268px] bg-white rounded-12 border border-gray-E5E5E6 shadow-[0_6px_16px_0px_rgba(8,19,56,0.12)] p-12",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-10",children:[(0,a.jsx)("button",{type:"button",onClick:function(){return b(function(e){return e.clone().subtract(1,"jMonth")})},className:"w-28 h-28 rounded-8 text-gray-6C6A7D hover:bg-gray-F0F0F0",children:"â¹"}),(0,a.jsxs)("span",{className:"text-13 leading-20 font-m text-black",children:[c[f.jMonth()]," ",u(f.jYear())]}),(0,a.jsx)("button",{type:"button",onClick:function(){return b(function(e){return e.clone().add(1,"jMonth")})},className:"w-28 h-28 rounded-8 text-gray-6C6A7D hover:bg-gray-F0F0F0",children:"âº"})]}),(0,a.jsx)("div",{className:"grid grid-cols-7 gap-2 mb-2",children:o.map(function(e){return(0,a.jsx)("div",{className:"text-center text-10 text-gray-9B9BAA py-2",children:e},e)})}),(0,a.jsxs)("div",{className:"grid grid-cols-7 gap-2",children:[Array.from({length:y}).map(function(e,n){return(0,a.jsx)("div",{},"b-".concat(n))}),N.map(function(e){var n=e.format("YYYY-MM-DD"),s=!!m&&n<m;return(0,a.jsx)("button",{type:"button",disabled:s,onClick:function(){r(n),p(!1)},className:"h-30 rounded-8 text-12 leading-18 transition ".concat(n===t?"bg-primary-main text-white font-m":s?"text-gray-C4CAD3 cursor-not-allowed":"text-gray-6C6A7D hover:bg-gray-F0F0F0"),children:u(e.format("jD"))},n)})]})]})]})}},59783:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return S}});
1var s=t(47568),a=t(14924),i=t(26042),r=t(69396),l=t(10253),c=t(36305),o=t(70655),u=t(85893),d=t(67294),m=t(41664),x=t.n(m),h=t(11163),g=t(44389),p=t(49759),v=t(32474),f=t(70707),b=t(20376),j=t(55290);function N(e){var n=e.label,t=e.value,s=e.onChange,a=e.hint,i=e.defaultTime,r=void 0===i?"00:00":i,c=(0,l.Z)(t?t.split("T"):["",""],2),o=c[0],d=void 0===o?"":o,m=c[1],x=void 0===m?"":m,h=function(e){d&&s("".concat(d,"T").concat(e||r))};return(0,u.jsxs)("div",{children:[(0,u.jsxs)("div",{className:"grid grid-cols-[1fr_120px] gap-x-8 items-end",children:[(0,u.jsx)(j.ZP,{label:n,value:d,onChange:function(e){if(!e)return s("");s("".concat(e,"T").concat(x||r))}}),(0,u.jsxs)("label",{className:"block",children:[(0,u.jsx)("span",{className:"block mb-6 text-12 leading-18 text-gray-6C6A7D font-m",children:"ساعت"}),(0,u.jsx)("input",{type:"time",value:x,disabled:!d,onChange:function(e){return h(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 transition disabled:bg-gray-F7F7F7 disabled:text-gray-9B9BAA"})]})]}),a&&(0,u.jsx)("span",{className:"block mt-4 text-11 leading-18 text-gray-9B9BAA",children:a})]})}var y=t(99871),C={name:"",code:"",internalNote:"",status:"DRAFT",priority:"0",isVisibleToUser:!1,audience:"ALL",userIds:[],cityIds:[],scope:"ALL",scopeLocationIds:[],scopeTypes:[],scopeAmenityIds:[],scopeHostIds:[],scopeResidenceIds:[],minResidenceRating:"",maxResidenceAgeDays:"",kind:"PERCENT",amount:"",maxDiscountAmount:"",base:"RENT",minReservationAmount:"",maxReservationAmount:"",startsAt:"",endsAt:"",travelStartDate:"",lastCheckoutDate:"",totalUsageLimit:"",perUserUsageLimit:"",combinableWithResidenceDiscount:!0,releaseQuotaOnCancel:!0,messages:{}},A=function(e){return(0,f.W_)(e)},I=function(e){return e?e.slice(0,16):""},D=function(e){return e?new Date(e).toISOString():null},E=function(e){return e?e.slice(0,10):""},R=function(e){return e?new Date("".concat(e,"T00:00:00")).toISOString():null};function S(){var e,n,t,m,f,S,k,U,Y,_,B,L,M,O=function(){var e,n;return{name:Q.name.trim(),code:Q.code.trim(),internalNote:Q.internalNote.trim()||null,status:Q.status,priority:null!==(e=A(Q.priority))&&void 0!==e?e:0,isVisibleToUser:Q.isVisibleToUser,audience:Q.audience,userIds:"SPECIFIC_USERS"===Q.audience?Q.userIds:[],cityIds:"CITY"===Q.audience?Q.cityIds:[],scope:Q.scope,scopeLocationIds:"LOCATION"===Q.scope?Q.scopeLocationIds:[],scopeTypes:"TYPE"===Q.scope?Q.scopeTypes:[],scopeAmenityIds:"AMENITY"===Q.scope?Q.scopeAmenityIds:[],scopeHostIds:"HOST"===Q.scope?Q.scopeHostIds:[],scopeResidenceIds:"RESIDENCES"===Q.scope?Q.scopeResidenceIds:[],minResidenceRating:A(Q.minResidenceRating),maxResidenceAgeDays:A(Q.maxResidenceAgeDays),kind:Q.kind,amount:null!==(n=A(Q.amount))&&void 0!==n?n:0,maxDiscountAmount:"PERCENT"===Q.kind?A(Q.maxDiscountAmount):null,base:Q.base,minReservationAmount:A(Q.minReservationAmount),maxReservationAmount:A(Q.maxReservationAmount),startsAt:D(Q.startsAt),endsAt:D(Q.endsAt),travelStartDate:R(Q.travelStartDate),lastCheckoutDate:R(Q.lastCheckoutDate),totalUsageLimit:A(Q.totalUsageLimit),perUserUsageLimit:A(Q.perUserUsageLimit),combinableWithResidenceDiscount:Q.combinableWithResidenceDiscount,releaseQuotaOnCancel:Q.releaseQuotaOnCancel,messages:Object.keys(Q.messages).length?Q.messages:null}},P=(0,h.useRouter)(),V=P.query.id,H="new"===V,$=H||"string"!=typeof V?null:Number(V),z=(0,l.Z)((0,d.useState)(C),2),Q=z[0],W=z[1],X=(0,l.Z)((0,d.useState)([]),2),q=X[0],G=X[1],K=(0,l.Z)((0,d.useState)([]),2),J=K[0],ee=K[1],en=(0,l.Z)((0,d.useState)([]),2),et=en[0],es=en[1],ea=(0,l.Z)((0,d.useState)(!1),2),ei=ea[0],er=ea[1],el=(0,l.Z)((0,d.useState)(null),2),ec=el[0],eo=el[1],eu=(0,l.Z)((0,d.useState)(!1),2),ed=eu[0],em=eu[1],ex=(0,g.u)("discount-options",y.hA).data,eh=(0,g.u)($?["discount",$]:null,function(){return(0,y.fL)($)}),eg=eh.data,ep=eh.isLoading,ev=(0,g.u)($?["discount-history",$]:null,function(){return(0,y.Qi)($)}).data;(0,d.useEffect)(function(){var e,n,t,s,a,i,r,l,c,o,u,d,m,x,h,g;eg&&(W({name:eg.name,code:eg.code,internalNote:null!==(l=eg.internalNote)&&void 0!==l?l:"",status:eg.status,priority:String(eg.priority),isVisibleToUser:eg.isVisibleToUser,audience:eg.audience,userIds:eg.users.map(function(e){return e.id}),cityIds:eg.cityIds,scope:eg.scope,scopeLocationIds:eg.scopeLocationIds,scopeTypes:eg.scopeTypes,scopeAmenityIds:eg.scopeAmenityIds,scopeHostIds:eg.scopeHostIds,scopeResidenceIds:eg.scopeResidenceIds,minResidenceRating:null!==(c=null===(e=eg.minResidenceRating)||void 0===e?void 0:e.toString())&&void 0!==c?c:"",maxResidenceAgeDays:null!==(o=null===(n=eg.maxResidenceAgeDays)||void 0===n?void 0:n.toString())&&void 0!==o?o:"",kind:eg.kind,amount:String(eg.amount),maxDiscountAmount:null!==(u=null===(t=eg.maxDiscountAmount)||void 0===t?void 0:t.toString())&&void 0!==u?u:"",base:eg.base,minReservationAmount:null!==(d=null===(s=eg.minReservationAmount)||void 0===s?void 0:s.toString())&&void 0!==d?d:"",maxReservationAmount:null!==(m=null===(a=eg.maxReservationAmount)||void 0===a?void 0:a.toString())&&void 0!==m?m:"",startsAt:I(eg.startsAt),endsAt:I(eg.endsAt),travelStartDate:E(eg.travelStartDate),lastCheckoutDate:E(eg.last
1CheckoutDate),totalUsageLimit:null!==(x=null===(i=eg.totalUsageLimit)||void 0===i?void 0:i.toString())&&void 0!==x?x:"",perUserUsageLimit:null!==(h=null===(r=eg.perUserUsageLimit)||void 0===r?void 0:r.toString())&&void 0!==h?h:"",combinableWithResidenceDiscount:eg.combinableWithResidenceDiscount,releaseQuotaOnCancel:eg.releaseQuotaOnCancel,messages:null!==(g=eg.messages)&&void 0!==g?g:{}}),G(eg.users.map(function(e){return{id:e.id,label:e.name||e.phone,hint:e.phone}})))},[eg]);var ef=function(e,n){W(function(t){return(0,r.Z)((0,i.Z)({},t),(0,a.Z)({},e,n))}),em(!1)},eb=(0,d.useCallback)((e=(0,s.Z)(function(e){return(0,o.__generator)(this,function(n){switch(n.label){case 0:return[4,(0,y.pz)(e)];case 1:return[2,n.sent().map(function(e){return{id:e.id,label:e.name||"بدÙÙ ÙØ§Ù
",hint:e.phone}})]}})}),function(n){return e.apply(this,arguments)}),[]),ej=(0,d.useCallback)((n=(0,s.Z)(function(e){return(0,o.__generator)(this,function(n){switch(n.label){case 0:return[4,(0,y.pz)(e,!0)];case 1:return[2,n.sent().map(function(e){return{id:e.id,label:e.name||"بدÙÙ ÙØ§Ù
",hint:e.phone}})]}})}),function(e){return n.apply(this,arguments)}),[]),eN=(0,d.useCallback)((t=(0,s.Z)(function(e){return(0,o.__generator)(this,function(n){switch(n.label){case 0:return[4,(0,y.wH)(e)];case 1:return[2,n.sent().map(function(e){return{id:e.id,label:e.name,hint:"".concat(null!==(m=e.cityName)&&void 0!==m?m:"â"," \xb7 کد ").concat(e.publicId)}})]}})}),function(e){return t.apply(this,arguments)}),[]);function ey(){return(ey=(0,s.Z)(function(){var e,n;return(0,o.__generator)(this,function(t){switch(t.label){case 0:er(!0),eo(null),t.label=1;case 1:if(t.trys.push([1,6,7,8]),!$)return[3,3];return[4,(0,y.Qz)($,O())];case 2:return t.sent(),em(!0),[3,5];case 3:return[4,(0,y.o1)(O())];case 4:e=t.sent(),P.replace("/admin/settings/discount-codes/".concat(e.id)),t.label=5;case 5:return[3,8];case 6:return eo((n=t.sent())instanceof Error?n.message:"Ø°Ø®ÛØ±Ù ÙØ´Ø¯"),[3,8];case 7:return er(!1),[7];case 8:return[2]}})})).apply(this,arguments)}var eC=(null!==(f=null==ex?void 0:ex.locations)&&void 0!==f?f:[]).map(function(e){return{id:e.id,label:e.name,hint:"PROVINCE"===e.type?"استاÙ":null!==(S=e.parentName)&&void 0!==S?S:"Ø´ÙØ±"}}),eA=(null!==(k=null==ex?void 0:ex.locations)&&void 0!==k?k:[]).filter(function(e){return"CITY"===e.type}).map(function(e){return{id:e.id,label:e.name,hint:e.parentName}}),eI=(null!==(U=null==ex?void 0:ex.amenities)&&void 0!==U?U:[]).map(function(e){return{id:e.id,label:e.name,hint:e.category}});if($&&ep)return(0,u.jsx)(p.Z,{title:"کد تخÙÛÙ",breadcrumb:(0,u.jsx)(x(),{href:"/admin",children:"Ø¯Ø§Ø´Ø¨ÙØ±Ø¯"}),children:(0,u.jsx)(v.Od,{className:"h-[520px]"})});var eD=(null!==(Y=null==eg?void 0:eg.usedCount)&&void 0!==Y?Y:0)>0;return(0,u.jsx)(p.Z,{title:H?"کد تخÙÛÙ Ø¬Ø¯ÛØ¯":null!==(_=null==eg?void 0:eg.name)&&void 0!==_?_:"کد تخÙÛÙ",breadcrumb:(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(x(),{href:"/admin",children:"Ø¯Ø§Ø´Ø¨ÙØ±Ø¯"})," / ",(0,u.jsx)(x(),{href:"/admin/settings",children:"ØªÙØ¸ÛÙ
ات"})," /"," ",(0,u.jsx)(x(),{href:"/admin/settings/discount-codes",children:"Ú©Ø¯ÙØ§Û تخÙÛÙ"})]}),actions:(0,u.jsxs)(u.Fragment,{children:[eg&&(0,u.jsx)(v.Ct,{tone:y.Ri[eg.effectiveStatus],children:y.NK[eg.effectiveStatus]}),(0,u.jsx)(v.zx,{onClick:function(){return ey.apply(this,arguments)},disabled:ei,children:ei?"در ØØ§Ù Ø°Ø®ÛØ±Ùâ¦":H?"ساخت کد تخÙÛÙ":"Ø°Ø®ÛØ±Ù تغÛÛØ±Ø§Øª"})]}),children:(0,u.jsxs)("div",{className:"grid gap-16 lg:grid-cols-[1fr_360px] items-start",children:[(0,u.jsxs)("div",{className:"flex flex-col gap-y-16",children:[ec&&(0,u.jsx)("div",{className:"rounded-10 bg-[#FEE] px-14 py-12 text-13 text-[#C62828]",children:ec}),ed&&(0,u.jsx)("div",{className:"rounded-10 bg-[#E8F5E9] px-14 py-12 text-13 text-[#1B5E20]",children:"تغÛÛØ±Ø§Øª Ø°Ø®ÛØ±Ù شد."}),(0,u.jsx)(v.Zb,{children:(0,u.jsxs)(b.$0,{title:"Ø§Ø·ÙØ§Ø¹Ø§Øª پاÛÙ",children:[(0,u.jsxs)("div",{className:"grid md:grid-cols-2 gap-14",children:[(0,u.jsx)(v.gN,{label:"ÙØ§Ù
تخÙÛÙ *",hint:"ÙÙØ· Ø¨Ø±Ø§Û Ø´ÙØ§Ø³Ø§ÛÛ Ø¯Ø§Ø®ÙÛØ ب٠Ù
ÙÙ
Ø§Ù ÙØ´Ø§Ù داد٠ÙÙ
ÛâØ´ÙØ¯.",children:(0,u.jsx)(v.II,{value:Q.name,onChange:function(e){return ef("name",e.target.value)}})}),(0,u.jsx)(v.gN,{label:"کد تخÙÛÙ *",hint:eD?"اÛ٠کد ÙØ¨ÙØ§Ù Ø§Ø³ØªÙØ§Ø¯Ù شد٠٠دÛگر ÙØ§Ø¨Ù تغÛÛØ± ÙÛØ³Øª.":"ØØ±Ù٠اÙÚ¯ÙÛØ³ÛØ Ø¹Ø¯Ø¯Ø Ø®Ø· ØªÛØ±Ù. Ø¨Ù Ø¨Ø²Ø±Ú¯Û Ù Ú©ÙÚÚ©Û ØØ±ÙÙ ØØ³Ø§Ø³ ÙÛØ³Øª.",children:(0,u.jsxs)("div",{className:"flex gap-x-8",children:[(0,u.jsx)(v.II,{dir:"ltr",className:"font-mono",value:Q.code,disabled:eD,onChange:function(e){return ef("code",e.target.value.toUpperCase())}}),!eD&&(0,u.jsx)(v.zx,{variant:"secondary",type:"button",onClick:(0,s.Z)(function(){var e;return(0,o.__generator)(this,function(n){switch(n.label){case 0:return e=["code"],[4,(0,y.bB)()];case 1:return[2,ef.apply(void 0,e.concat([n.sent().code]))]}})}),children:"تÙÙÛØ¯"})]})})]}),(0,u.jsx)(v.gN,{label:"ØªÙØ¶ÛØØ§Øª داخÙÛ",className:"mt-14",children:(0,u.jsx)("textarea",{value:Q.internalNote,onChange:function(e){return ef("internalNote",e.target.value)},rows:2,className:"w-full px-14 py-10 rounded-10 border border-gray-E5E5E6 text-14 leading-22 outline-none focus:border-primary-main transition"})}),(0,u.jsxs)("div",{className:"grid md:grid-cols-3 gap-14 mt-14 items-end",children:[(0,u.jsx)(v.gN,{label:"ÙØ¶Ø¹Ûت",children:(0,u.jsxs)(v.Ph,{className:"w-full",value:Q.status,onChange:function(e){return ef("status",e.target.value)},children:[(0,u.jsx)("option",{value:"DRAFT",children:"Ù¾ÛØ´âÙÙÛØ³"}),(0,u.jsx)("option",{value:"ACTIVE",children:"ÙØ¹Ø§Ù"}),(0,u.jsx)("option",{value:"DISABLED",children:"ØºÛØ±ÙعاÙ"}),(0,u.jsx)("option",{value:"ARCHIVED",children:"آرشÛÙØ´Ø¯Ù"})]})}),(0,u.jsx)(v.gN,{label:"اÙÙÙÛØª",hint:"ÙÙØªÛ ÚÙØ¯ کد ÙÙ
âØ²Ù
Ø§Ù ÙØ§Ø¨Ù اعÙ
Ø§Ù Ø¨Ø§Ø´ÙØ¯Ø عدد Ø¨Ø²Ø±Ú¯âØªØ± Ø¨Ø±ÙØ¯Ù است.",children:(0,u.jsx)(v.II,{inputMode:"numeric",value:Q.priority,onChange:function(e){return ef("priority",e.target.value)}})}),(0,u.jsx)(v.ZD,{checked:Q.isVisibleToUser,onChange:function(e){return ef("isVisibleToUser",e)},label:"در ÙÙØ±Ø³Øª تخÙÛÙâÙØ§Û کاربر ÙÙ
Ø§ÛØ´ Ø¯Ø§Ø¯Ù Ø´ÙØ¯"})]})]})}),(0,u.jsx)(v.Zb,{children:(0,u.jsxs)(b.$0,{title:"تخÙÛ٠براÛ",desc:"\xabÚ©Ø§Ø±Ø¨Ø±Ø§Ù Ø¬Ø¯ÛØ¯\xbb ÛØ¹ÙÛ ÙÛÚ Ø±Ø²Ø±Ù Ù
ÙÙÙÛ ÙØ¯Ø§Ø´ØªÙâØ§ÙØ¯ â Ø§Ø² ØªØ§Ø±ÛØ®ÚÙâÛ Ø±Ø²Ø±Ù Ø®ÙØ§Ùد٠Ù
ÛâØ´ÙØ¯Ø Ù٠از ÛÚ© ÙÙÚ¯ رÙÛ ØØ³Ø§Ø¨.",children:[(0,u.jsx)(b.Ee,{value:Q.audience,onChange:function(e){return ef("audience",e)},options:Object.keys(y.rc).map(function(e){return{value:e,label:y.rc[e]}})}),"SPECIFIC_USERS"===Q.audience&&(0,u.jsxs)("div",{className:"mt-14",children:[(0,u.jsxs)("p",{className:"mb-8 text-12 text-gray-6C6A7D",children:["کد با ",(0,u.jsx)("b",{children:"Ø´ÙØ§Ø³ÙâÛ Ú©Ø§Ø±Ø¨Ø±"})," Ø¨Ø±Ø±Ø³Û Ù
ÛâØ´ÙØ¯Ø Ù٠با Ø´Ù
Ø§Ø±Ù ÛØ§ اÛÙ
ÛÙ â پس اگر Ú©Ø³Û Ø´Ù
ارÙâØ§Ø´ را Ø¹ÙØ¶ Ú©ÙØ¯Ø کدش با Ø®ÙØ¯Ø´ Ù
ÛâÙ
Ø§ÙØ¯."]}
1),(0,u.jsx)(b.ID,{selected:Q.userIds,resolved:q,onChange:function(e,n){ef("userIds",e),G(n)},search:eb,placeholder:"ÙØ§Ù
Ø Ø´Ù
Ø§Ø±Ù ÛØ§ اÛÙ
Û٠کاربر"})]}),"CITY"===Q.audience&&(0,u.jsx)("div",{className:"mt-14",children:(0,u.jsx)(b.NU,{choices:eA,selected:Q.cityIds,onChange:function(e){return ef("cityIds",e)},searchPlaceholder:"جستجÙÛ Ø´ÙØ±"})})]})}),(0,u.jsx)(v.Zb,{children:(0,u.jsxs)(b.$0,{title:"اعÙ
ا٠بر رÙÛ",desc:"ÛÚ© Ù
ØÙر Ø§ÙØªØ®Ø§Ø¨ Ù
ÛâØ´ÙØ¯Ø ÙÙ ÚÙØ¯ تا با ÙÙ
â ÙگرÙÙ Ø¨Ø§ÛØ¯ Ù
شخص Ù
ÛâØ´Ø¯ Ú©Ù ØªØ±Ú©ÛØ¨Ø´Ø§Ù \xabÙ\xbb است ÛØ§ \xabÛØ§\xbb.",children:[(0,u.jsx)(b.Ee,{value:Q.scope,onChange:function(e){return ef("scope",e)},options:Object.keys(y.Cd).map(function(e){return{value:e,label:y.Cd[e]}}),columns:3}),"LOCATION"===Q.scope&&(0,u.jsxs)("div",{className:"mt-14",children:[(0,u.jsx)("p",{className:"mb-8 text-12 text-gray-6C6A7D",children:"Ø§ÙØªØ®Ø§Ø¨ ÛÚ© Ø§Ø³ØªØ§ÙØ Ø´ÙØ±ÙØ§Û Ø²ÛØ±Ù
جÙ
ÙØ¹ÙâØ§Ø´ را ÙÙ
Ù
ÛâÚ¯ÛØ±Ø¯."}),(0,u.jsx)(b.NU,{choices:eC,selected:Q.scopeLocationIds,onChange:function(e){return ef("scopeLocationIds",e)},searchPlaceholder:"جستجÙÛ Ø´ÙØ± ÛØ§ استاÙ"})]}),"TYPE"===Q.scope&&(0,u.jsx)("div",{className:"mt-14 flex flex-wrap gap-8",children:(null!==(B=null==ex?void 0:ex.residenceTypes)&&void 0!==B?B:[]).map(function(e){return(0,u.jsxs)("label",{className:"flex items-center gap-x-8 rounded-10 border px-12 py-10 cursor-pointer transition ".concat(Q.scopeTypes.includes(e.value)?"border-primary-main bg-primary-main/5":"border-gray-E5E5E6 hover:bg-gray-F7F7F7"),children:[(0,u.jsx)("input",{type:"checkbox",checked:Q.scopeTypes.includes(e.value),onChange:function(){return ef("scopeTypes",Q.scopeTypes.includes(e.value)?Q.scopeTypes.filter(function(n){return n!==e.value}):(0,c.Z)(Q.scopeTypes).concat([e.value]))},className:"w-16 h-16 accent-primary-main"}),(0,u.jsx)("span",{className:"text-13",children:e.label})]},e.value)})}),"AMENITY"===Q.scope&&(0,u.jsxs)("div",{className:"mt-14",children:[(0,u.jsxs)("p",{className:"mb-8 text-12 text-gray-6C6A7D",children:["Ø§ÙØ§Ù
ØªÚ¯Ø§Ù Ø¨Ø§ÛØ¯ ",(0,u.jsx)("b",{children:"ÙÙ
ÙâÛ"})," Ù
ÙØ§Ø±Ø¯ Ø§ÙØªØ®Ø§Ø¨âشد٠را Ø¯Ø§Ø´ØªÙ Ø¨Ø§Ø´Ø¯Ø ÙÙ ÛÚ©Û Ø§Ø² Ø¢ÙâÙØ§."]}),(0,u.jsx)(b.NU,{choices:eI,selected:Q.scopeAmenityIds,onChange:function(e){return ef("scopeAmenityIds",e)},searchPlaceholder:"جستجÙÛ Ø§Ù
Ú©Ø§ÙØ§Øª"})]}),"HOST"===Q.scope&&(0,u.jsx)("div",{className:"mt-14",children:(0,u.jsx)(b.ID,{selected:Q.scopeHostIds,resolved:J,onChange:function(e,n){ef("scopeHostIds",e),ee(n)},search:ej,placeholder:"ÙØ§Ù
ÛØ§ Ø´Ù
ار٠Ù
ÛØ²Ø¨Ø§Ù"})}),"RESIDENCES"===Q.scope&&(0,u.jsx)("div",{className:"mt-14",children:(0,u.jsx)(b.ID,{selected:Q.scopeResidenceIds,resolved:et,onChange:function(e,n){ef("scopeResidenceIds",e),es(n)},search:eN,placeholder:"ÙØ§Ù
ÛØ§ کد Ø§ÙØ§Ù
تگاÙ"})}),(0,u.jsxs)("div",{className:"grid md:grid-cols-2 gap-14 mt-16 pt-16 border-t border-gray-F0F0F0",children:[(0,u.jsx)(v.gN,{label:"ØØ¯Ø§Ù٠اÙ
ØªÛØ§Ø² Ø§ÙØ§Ù
تگاÙ",hint:"بÛÙ Û° تا Ûµ. خاÙÛ = بدÙ٠شرط.",children:(0,u.jsx)(v.II,{inputMode:"decimal",value:Q.minResidenceRating,onChange:function(e){return ef("minResidenceRating",e.target.value)}})}),(0,u.jsx)(v.gN,{label:"ÙÙØ· Ø§ÙØ§Ù
تگاÙâÙØ§Û تازÙâØ«Ø¨ØªâØ´Ø¯Ù (Ø±ÙØ²)",hint:"Ù
Ø«ÙØ§Ù Û¹Û° ÛØ¹ÙÛ Ø§ÙØ§Ù
تگاÙâÙØ§ÛÛ Ú©Ù ØªØ§ Û¹Û° Ø±ÙØ² Ù¾ÛØ´ ثبت شدÙâØ§ÙØ¯.",children:(0,u.jsx)(v.II,{inputMode:"numeric",value:Q.maxResidenceAgeDays,onChange:function(e){return ef("maxResidenceAgeDays",e.target.value)}})})]})]})}),(0,u.jsx)(v.Zb,{children:(0,u.jsxs)(b.$0,{title:"باز٠زÙ
اÙÛ",children:[(0,u.jsx)("p",{className:"mb-10 text-12 leading-20 text-gray-6C6A7D font-m",children:"بازÙâÛ ÙØ¹Ø§Ù Ø¨ÙØ¯Ù کد"}),(0,u.jsxs)("div",{className:"grid md:grid-cols-2 gap-14",children:[(0,u.jsx)(N,{label:"Ø´Ø±ÙØ¹",hint:"خاÙÛ = از ÙÙ
ÛÙ ØØ§Ùا",value:Q.startsAt,onChange:function(e){return ef("startsAt",e)}}),(0,u.jsx)(N,{label:"Ù¾Ø§ÛØ§Ù",hint:"خاÙÛ = تا ÙÙØªÛ ØºÛØ±ÙØ¹Ø§Ù Ø´ÙØ¯ ÛØ§ ظرÙÛØªØ´ تÙ
اÙ
Ø´ÙØ¯",value:Q.endsAt,onChange:function(e){return ef("endsAt",e)},defaultTime:"23:59"})]}),(0,u.jsx)("p",{className:"mt-16 mb-10 text-12 leading-20 text-gray-6C6A7D font-m",children:"بازÙâÛ ØªØ§Ø±ÛØ® Ø§ÙØ§Ù
ت Ù
جاز"}),(0,u.jsxs)("div",{className:"grid md:grid-cols-2 gap-14",children:[(0,u.jsx)(j.ZP,{label:"ØªØ§Ø±ÛØ® Ø´Ø±ÙØ¹ Ø³ÙØ±",hint:"ØªØ§Ø±ÛØ® ÙØ±Ùد Ø±Ø²Ø±Ù Ø¨Ø§ÛØ¯ از اÛÙ Ø±ÙØ² ÛØ§ بعدش باشد.",value:Q.travelStartDate,onChange:function(e){return ef("travelStartDate",e)}}),(0,u.jsx)(j.ZP,{label:"آخرÛÙ ØªØ§Ø±ÛØ® Ù
جاز Ø®Ø±ÙØ¬",hint:"شاÙ
Ù Ø®ÙØ¯Ù ÙÙ
ÛÙ Ø±ÙØ² است â Ø±Ø²Ø±ÙÛ Ú©Ù ÙÙ
ÛÙ Ø±ÙØ² تÙ
اÙ
Ø´ÙØ¯ Ù¾Ø°ÛØ±Ùت٠Ù
ÛâØ´ÙØ¯.",value:Q.lastCheckoutDate,onChange:function(e){return ef("lastCheckoutDate",e)}})]})]})}),(0,u.jsx)(v.Zb,{children:(0,u.jsxs)(b.$0,{title:"Ù
ØØ§Ø³Ø¨Ù تخÙÛÙ",children:[(0,u.jsxs)("div",{className:"grid md:grid-cols-2 gap-14",children:[(0,u.jsx)(v.gN,{label:"ÙÙØ¹ تخÙÛÙ",children:(0,u.jsxs)(v.Ph,{className:"w-full",value:Q.kind,onChange:function(e){return ef("kind",e.target.value)},children:[(0,u.jsx)("option",{value:"PERCENT",children:"درصدÛ"}),(0,u.jsx)("option",{value:"FIXED",children:"Ù
Ø¨ÙØº ثابت"})]})}),(0,u.jsx)(v.gN,{label:"PERCENT"===Q.kind?"درصد تخÙÛÙ *":"Ù
Ø¨ÙØº تخÙÛÙ (تÙÙ
اÙ) *",hint:"PERCENT"===Q.kind?"بÛÙ Û± تا Û±Û°Û°":void 0,children:(0,u.jsx)(v.II,{inputMode:"decimal",value:Q.amount,onChange:function(e){return ef("amount",e.target.value)}})}),"PERCENT"===Q.kind&&(0,u.jsx)(v.gN,{label:"ØØ¯Ø§Ú©Ø«Ø± Ù
ÛØ²Ø§Ù ØªØ£Ø«ÛØ± (تÙÙ
اÙ)",hint:"سÙ٠تخÙÛÙ. خاÙÛ = بدÙ٠سÙÙ. ÙÙØ· Ø¨Ø±Ø§Û ØªØ®ÙÛÙ Ø¯Ø±ØµØ¯Û Ù
Ø¹ÙØ§ دارد.",children:(0,u.jsx)(v.II,{inputMode:"numeric",value:Q.maxDiscountAmount,onChange:function(e){return ef("maxDiscountAmount",e.target.value)}})}),(0,u.jsx)(v.gN,{label:"Ù
Ø¨ÙØº Ù
Ø´Ù
Ù٠تخÙÛÙ",hint:"Ù¾ÛØ´âÙØ±Ø¶ ÙÙØ· Ù
Ø¨ÙØº Ø§ÙØ§Ù
ت Ø§Ø³ØªØ Ú©Ø§Ø±Ù
زد Ù Ù
اÙÛØ§Øª جز٠Ù
Ø¨ÙØº Ù
Ø´Ù
ÙÙ ÙÛØ³ØªÙد.",children:(0,u.jsx)(v.Ph,{className:"w-full",value:Q.base,onChange:function(e){return ef("base",e.target.value)},children:Object.keys(y.y$).map(function(e){return(0,u.jsx)("option",{value:e,children:y.y$[e]},e)})})}),(0,u.jsx)(v.gN,{label:"ØØ¯Ø§ÙÙ Ù
Ø¨ÙØº رزر٠(تÙÙ
اÙ)",hint:"خاÙÛ = بدÙÙ ØØ¯Ø§ÙÙ",children:(0,u.jsx)(v.II,{inputMode:"numeric",value:Q.minReservationAmount,onChange:function(e){return ef("minReservationAmount",e.target.value)}})}),(0,u.jsx)(v.gN,{label:"ØØ¯Ø§Ú©Ø«Ø± Ù
Ø¨ÙØº رزر٠(تÙÙ
اÙ)",hint:"خاÙÛ = بدÙ٠سÙÙ",children:(0,u.jsx)(v.II,{inputMode:"numeric",value:Q.maxReservationAmount,onChange:function(e){return ef("maxReservationAmount",e.target.value)}})})]}),(0,u.jsxs)("p",{className:"mt-14 rounded-10 bg-gray-F7F7F7 px-14 py-10 text-12 leading-20 text-gray-6C6A7D",children:["Ù
Ø¨ÙØº تخÙÛ٠از ",(0,u.jsx)("b",{children:"سÙÙ
کارÙ
زد Ø³Ø§ÛØª"})," Ú©Ù
Ù
ÛâØ´ÙØ¯Ø Ù٠از درآÙ
د Ù
ÛØ²Ø¨Ø§Ù. سÙÙ
Ù
ÛØ²Ø¨Ø§Ù رÙÛ Ø±Ø²Ø±ÙÙØ§Û اÛÙ Ú©Ù
Ù¾ÛÙ ÙÙ
ا٠ÚÛØ²Û است ک٠بدÙ٠کد Ø¨ÙØ¯."]})]})}),(0,u.jsx)(v.Zb,{children:(0,u.jsxs)(b.$0,{title:"Ù
ØØ¯ÙØ¯ÛØª Ø§Ø³ØªÙØ§Ø¯Ù",children:[(0,u.jsxs)("div",{className:"grid md:grid-cols-2 gap-14",children:[(0,u.jsx)(v.gN,{label:"تعداد Ú©Ù Ø§Ø³ØªÙØ§Ø¯Ù",hint:"خاÙÛ = ÙØ§Ù
ØØ¯Ùد. ØµÙØ± = ÙÛÚâکس ÙÙ
ÛâØªÙØ§Ùد Ø§Ø³ØªÙØ§Ø¯Ù Ú©ÙØ¯.",children:(0,u.jsx)(v.II,{inputMode:"numeric",value:Q.totalUsageLimit,onChange:function(e){return ef("totalUsageLimit",e.target.value)}})}
1),(0,u.jsx)(v.gN,{label:"تعداد Ø§Ø³ØªÙØ§Ø¯Ù Ø¨Ø±Ø§Û ÙØ± کاربر",hint:"خاÙÛ = ÙØ§Ù
ØØ¯Ùد",children:(0,u.jsx)(v.II,{inputMode:"numeric",value:Q.perUserUsageLimit,onChange:function(e){return ef("perUserUsageLimit",e.target.value)}})})]}),(0,u.jsxs)("div",{className:"mt-14 flex flex-col gap-y-12",children:[(0,u.jsx)(v.ZD,{checked:Q.combinableWithResidenceDiscount,onChange:function(e){return ef("combinableWithResidenceDiscount",e)},label:"با تخÙÛÙ ÙÙØªÚ¯Û/Ù
Ø§ÙØ§ÙÙâÛ Ø®ÙØ¯ Ø§ÙØ§Ù
ØªÚ¯Ø§Ù ÙØ§Ø¨Ù ØªØ±Ú©ÛØ¨ باشد"}),(0,u.jsx)(v.ZD,{checked:Q.releaseQuotaOnCancel,onChange:function(e){return ef("releaseQuotaOnCancel",e)},label:"در ØµÙØ±Øª ÙØºÙ ÛØ§ اÙÙØ¶Ø§Û Ø±Ø²Ø±ÙØ سÙÙ
ÛÙâÛ Ú©Ø¯ برگردد"})]})]})}),(0,u.jsx)(v.Zb,{children:(0,u.jsx)(Z,{defaults:null!==(L=null==eg?void 0:eg.defaultMessages)&&void 0!==L?L:{},value:Q.messages,onChange:function(e){return ef("messages",e)}})})]}),(0,u.jsxs)("div",{className:"flex flex-col gap-y-16",children:[$&&(0,u.jsx)(T,{code:Q.code}),$&&(0,u.jsx)(w,{id:$,locations:null!==(M=null==ex?void 0:ex.locations)&&void 0!==M?M:[]}),$&&(0,u.jsx)(F,{rows:null!=ev?ev:[]})]})]})})}function k(e){var n=e.label,t=e.value;return(0,u.jsxs)("div",{className:"flex items-center justify-between gap-x-12 border-b border-gray-F0F0F0 pb-8 last:border-0",children:[(0,u.jsx)("dt",{className:"text-gray-6C6A7D",children:n}),(0,u.jsx)("dd",{className:"font-m text-black",children:t})]})}function Z(e){var n,t=e.defaults,s=e.value,a=e.onChange,r=(0,l.Z)((0,d.useState)(!1),2),c=r[0],o=r[1],m=Object.keys(t),x=Object.keys(s).length;return(0,u.jsx)(b.$0,{title:"Ù¾ÛØ§Ù
âÙØ§Û خطا",badge:x>0?"".concat((0,v.N)(x)," Ù¾ÛØ§Ù
Ø³ÙØ§Ø±Ø´Û"):void 0,desc:"ÙØ± شرط Ù¾ÛØ§Ù
Ø®ÙØ¯Ø´ را دارد. خاÙÛ Ú¯Ø°Ø§Ø´ØªÙ ÛØ¹ÙÛ Ø§Ø³ØªÙØ§Ø¯Ù از Ù
ØªÙ Ù¾ÛØ´âÙØ±Ø¶.",children:0===m.length?(0,u.jsx)("p",{className:"text-13 text-gray-9B9BAA",children:"پس از Ø°Ø®ÛØ±ÙâÛ Ø§ÙÙÛÙØ ÙÙØ±Ø³Øª Ù¾ÛØ§Ù
âÙØ§ اÛÙØ¬Ø§ ÙÙ
Ø§ÛØ´ داد٠Ù
ÛâØ´ÙØ¯."}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(v.zx,{variant:"secondary",type:"button",onClick:function(){return o(function(e){return!e})},children:c?"بستÙ":"ÙÛØ±Ø§ÛØ´ ".concat((0,v.N)(m.length)," Ù¾ÛØ§Ù
")}),c&&(0,u.jsx)("div",{className:"mt-14 flex flex-col gap-y-10",children:m.map(function(e){return(0,u.jsx)(v.gN,{label:e,children:(0,u.jsx)(v.II,{value:null!==(n=s[e])&&void 0!==n?n:"",placeholder:t[e],onChange:function(n){var t=(0,i.Z)({},s);n.target.value.trim()?t[e]=n.target.value:delete t[e],a(t)}})},e)})})]})})}function T(e){var n,t,a=e.code,i=(0,l.Z)((0,d.useState)([]),2),r=i[0],c=i[1],m=(0,l.Z)((0,d.useState)([]),2),x=m[0],h=m[1],g=(0,l.Z)((0,d.useState)([]),2),p=g[0],N=g[1],C=(0,l.Z)((0,d.useState)([]),2),A=C[0],I=C[1],D=(0,l.Z)((0,d.useState)(""),2),E=D[0],R=D[1],S=(0,l.Z)((0,d.useState)(""),2),k=S[0],Z=S[1],T=(0,l.Z)((0,d.useState)("5000000"),2),w=T[0],F=T[1],U=(0,l.Z)((0,d.useState)(null),2),Y=U[0],_=U[1],B=(0,l.Z)((0,d.useState)(!1),2),L=B[0],M=B[1],O=(0,l.Z)((0,d.useState)(null),2),P=O[0],V=O[1],H=(0,d.useCallback)((n=(0,s.Z)(function(e){return(0,o.__generator)(this,function(n){switch(n.label){case 0:return[4,(0,y.wH)(e)];case 1:return[2,n.sent().map(function(e){return{id:e.id,label:e.name,hint:e.cityName}})]}})}),function(e){return n.apply(this,arguments)}),[]),$=(0,d.useCallback)((t=(0,s.Z)(function(e){return(0,o.__generator)(this,function(n){switch(n.label){case 0:return[4,(0,y.pz)(e)];case 1:return[2,n.sent().map(function(e){return{id:e.id,label:e.name||"بدÙÙ ÙØ§Ù
",hint:e.phone}})]}})}),function(e){return t.apply(this,arguments)}),[]);function z(){return(z=(0,s.Z)(function(){var e,n,t;return(0,o.__generator)(this,function(s){switch(s.label){case 0:M(!0),V(null),_(null),s.label=1;case 1:return s.trys.push([1,3,4,5]),[4,(0,y.nX)({code:a,residenceId:r[0],userId:null!==(e=p[0])&&void 0!==e?e:null,startDate:E,endDate:k,rentAmount:null!==(n=(0,f.W_)(w))&&void 0!==n?n:0})];case 2:return _.apply(void 0,[s.sent()]),[3,5];case 3:return V((t=s.sent())instanceof Error?t.message:"تست Ø§ÙØ¬Ø§Ù
ÙØ´Ø¯"),[3,5];case 4:return M(!1),[7];case 5:return[2]}})})).apply(this,arguments)}var Q=a&&r.length>0&&E&&k;return(0,u.jsx)(v.Zb,{children:(0,u.jsx)(b.$0,{title:"تست کد",desc:"ÚÛØ²Û Ø°Ø®ÛØ±Ù ÙÙ
ÛâØ´ÙØ¯ ٠سÙÙ
ÛÙâÛ Ú©Ø¯ Ù
صر٠ÙÙ
ÛâØ´ÙØ¯.",children:(0,u.jsxs)("div",{className:"flex flex-col gap-y-12",children:[(0,u.jsx)(b.ID,{selected:r.slice(0,1),resolved:x,onChange:function(e,n){c(e.slice(-1)),h(n.slice(-1))},search:H,placeholder:"Ø§ÙØ§Ù
تگا٠آزÙ
Ø§ÛØ´Û"}),(0,u.jsx)(b.ID,{selected:p.slice(0,1),resolved:A,onChange:function(e,n){N(e.slice(-1)),I(n.slice(-1))},search:$,placeholder:"کاربر آزÙ
Ø§ÛØ´Û (خاÙÛ = Ù
ÙÙ
Ø§Ù ÙØ§Ø±Ø¯ÙشدÙ
1)"}),(0,u.jsxs)("div",{className:"grid grid-cols-2 gap-10",children:[(0,u.jsx)(j.ZP,{label:"ØªØ§Ø±ÛØ® ÙØ±Ùد",value:E,onChange:R}),(0,u.jsx)(j.ZP,{label:"ØªØ§Ø±ÛØ® Ø®Ø±ÙØ¬",value:k,onChange:Z})]}),(0,u.jsx)(v.gN,{label:"Ù
Ø¨ÙØº Ø§ÙØ§Ù
ت (تÙÙ
اÙ)",children:(0,u.jsx)(v.II,{inputMode:"numeric",value:w,onChange:function(e){return F(e.target.value)}})}),(0,u.jsx)(v.zx,{type:"button",onClick:function(){return z.apply(this,arguments)},disabled:!Q||L,children:L?"در ØØ§Ù بررسÛâ¦":"تست Ú©Ù"}),P&&(0,u.jsx)("p",{className:"text-12 text-[#C62828]",children:P}),Y&&Y.ok&&(0,u.jsxs)("div",{className:"rounded-10 bg-[#E8F5E9] px-14 py-12 text-13 text-[#1B5E20]",children:[(0,u.jsx)("p",{className:"font-m mb-6",children:"کد اعÙ
ا٠Ù
ÛâØ´ÙØ¯"}),(0,u.jsxs)("p",{children:["Ù
Ø¨ÙØº Ù
Ø´Ù
ÙÙ: ",(0,v.ND)(Y.eligibleAmount)]}),(0,u.jsxs)("p",{children:["Ù
Ø¨ÙØº تخÙÛÙ: ",(0,v.ND)(Y.discountAmount)]}),(0,u.jsxs)("p",{children:["Ù¾Ø±Ø¯Ø§Ø®ØªÛ ÙÙØ§ÛÛ: ",(0,v.ND)(Y.payableAfter)]}),Y.cappedByCeiling&&(0,u.jsx)("p",{className:"mt-6 text-12",children:"سÙ٠تخÙÛ٠اعÙ
ا٠شد."})]}),Y&&!Y.ok&&(0,u.jsxs)("div",{className:"rounded-10 bg-[#FEE] px-14 py-12 text-13 text-[#C62828]",children:[(0,u.jsx)("p",{className:"font-m mb-6",children:"کد رد شد"}),(0,u.jsx)("p",{children:Y.message}),(0,u.jsxs)("p",{className:"mt-6 text-12 text-gray-6C6A7D",children:["Ø´Ø±Ø·Û Ú©Ù Ø±Ø¯ کرد: ",(0,u.jsx)("span",{className:"font-mono",children:Y.failedRule})]})]})]})})})}function w(e){var n,t,s,a,r,c,o,m=e.id,x=e.locations,h=(0,l.Z)((0,d.useState)({}),2),p=h[0],f=h[1],N=(0,g.u)(["discount-stats",m,p],function(){return(0,y.lN)(m,p)}),C=N.data,A=N.isLoading,I=function(e,n){return f(function(t){var s=(0,i.Z)({},t);return void 0===n||""===n||null===n?delete s[e]:s[e]=n,s})},D=Object.keys(p).length;return(0,u.jsx)(v.Zb,{children:(0,u.jsxs)(b.$0,{title:"گزارش عÙ
Ùکرد",badge:D?"".concat((0,v.N)(D)," ÙÛÙØªØ±"):void 0,desc:"Ù
صرÙâÙØ§Û آزادشد٠در ÙÛÚâکداÙ
از Ù
Ø¨ÙØºâÙØ§ ØØ³Ø§Ø¨ ÙÙ
ÛâØ´ÙÙØ¯.",children:[(0,u.jsxs)("div",{className:"grid grid-cols-2 gap-8 mb-14",children:[(0,u.jsx)(j.ZP,{label:"از ØªØ§Ø±ÛØ®",value:null!==(s=null===(n=p.from)||void 0===n?void 0:n.slice(0,10))&&void 0!==s?s:"",onChange:function(e){return I("from",e?new Date("".concat(e,"T00:00:00")).toISOString():void 0)}}),(0,u.jsx)(j.ZP,{label:"تا ØªØ§Ø±ÛØ®",value:null!==(a=null===(t=p.to)||void 0===t?void 0:t.slice(0,10))&&void 0!==a?a:"",onChange:function(e){return I("to",e?new Date("".concat(e,"T23:59:59")).toISOString():void 0)}})]}),(0,u.jsxs)("div",{className:"grid grid-cols-2 gap-8 mb-14",children:[(0,u.jsx)(v.gN,{label:"Ø´ÙØ± Ø§ÙØ§Ù
تگاÙ",children:(0,u.jsxs)(v.Ph,{className:"w-full",value:null!==(r=p.locationId)&&void 0!==r?r:"",onChange:function(e){return I("locationId",e.target.value?Number(e.target.value):void 0)},children:[(0,u.jsx)("option",{value:"",children:"ÙÙ
Ù"}),x.filter(function(e){return"CITY"===e.type}).map(function(e){return(0,u.jsx)("option",{value:e.id,children:e.name},e.id)})]})}),(0,u.jsx)(v.gN,{label:"ÙØ¶Ø¹Ûت رزرÙ",children:(0,u.jsxs)(v.Ph,{className:"w-full",value:null!==(c=p.reservationState)&&void 0!==c?c:"",onCh
1ange:function(e){return I("reservationState",e.target.value||void 0)},children:[(0,u.jsx)("option",{value:"",children:"ÙÙ
Ù"}),Object.entries(y.ZB).map(function(e){var n=(0,l.Z)(e,2),t=n[0],s=n[1];return(0,u.jsx)("option",{value:t,children:s},t)})]})})]}),D>0&&(0,u.jsx)(v.zx,{variant:"secondary",type:"button",className:"mb-14",onClick:function(){return f({})},children:"برداشت٠ÙÛÙØªØ±Ùا"}),A&&(0,u.jsx)(v.Od,{className:"h-[220px]"}),C&&!A&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)("dl",{className:"flex flex-col gap-y-8 text-13",children:[(0,u.jsx)(k,{label:"Ø¯ÙØ¹Ø§Øª Ø§Ø³ØªÙØ§Ø¯Ù",value:(0,v.N)(C.uses)}),(0,u.jsx)(k,{label:"کاربرا٠Ûکتا",value:(0,v.N)(C.distinctUsers)}),(0,u.jsx)(k,{label:"Ù
ØµØ±Ù ÙØ·Ø¹Û",value:(0,v.N)(C.consumed)}),(0,u.jsx)(k,{label:"در Ø§ÙØªØ¸Ø§Ø± پرداخت",value:(0,v.N)(C.reserved)}),(0,u.jsx)(k,{label:"آزادشد٠(ÙØºÙ ÛØ§ اÙÙØ¶Ø§)",value:(0,v.N)(C.released)}),(0,u.jsx)(k,{label:"ظرÙÛØª باÙÛâÙ
Ø§ÙØ¯Ù",value:null===C.remainingUses?"ÙØ§Ù
ØØ¯Ùد":(0,v.N)(C.remainingUses)}),(0,u.jsx)(k,{label:"ÙØ±Ø® Ø±Ø³ÛØ¯Ù Ø¨Ù Ø±Ø²Ø±Ù ÙØ·Ø¹Û",value:"".concat((0,v.N)(C.completionRate),"Ùª")})]}),(0,u.jsxs)("div",{className:"mt-14 grid grid-cols-2 gap-8",children:[(0,u.jsxs)("div",{className:"rounded-10 bg-[#FEF2F2] px-12 py-10",children:[(0,u.jsx)("p",{className:"text-11 text-[#9B2C2C] mb-2",children:"Ø³Ø§ÛØª پرداخت کرد"}),(0,u.jsx)("p",{className:"text-14 font-m text-[#C62828]",children:(0,v.ND)(C.totalDiscountGiven)}),(0,u.jsxs)("p",{className:"mt-2 text-10 text-gray-9B9BAA",children:["Ù
ÛØ§ÙÚ¯ÛÙ ",(0,v.ND)(C.averageDiscount)]})]}),(0,u.jsxs)("div",{className:"rounded-10 bg-[#E8F5E9] px-12 py-10",children:[(0,u.jsx)("p",{className:"text-11 text-[#1B5E20] mb-2",children:"ارزش رزرÙÙØ§"}),(0,u.jsx)("p",{className:"text-14 font-m text-[#1B5E20]",children:(0,v.ND)(C.totalBookingValue)}),(0,u.jsxs)("p",{className:"mt-2 text-10 text-gray-9B9BAA",children:["Ù
ÛØ§ÙÚ¯ÛÙ ",(0,v.ND)(C.averageBookingValue)]})]})]}),C.byCity.length>0&&(0,u.jsxs)("div",{className:"mt-16",children:[(0,u.jsx)("h3",{className:"text-12 font-m text-gray-6C6A7D mb-8",children:"Ø´ÙØ±ÙØ§Û Ø§Ø³ØªÙØ§Ø¯ÙâØ´Ø¯Ù"}),(0,u.jsx)("dl",{className:"flex flex-col gap-y-6 text-12",children:C.byCity.slice(0,8).map(function(e){return(0,u.jsx)(k,{label:e.name,value:"".concat((0,v.N)(e.uses)," بار \xb7 ").concat((0,v.ND)(e.discount))},e.locationId)})})]}),C.byResidence.length>0&&(0,u.jsxs)("div",{className:"mt-16",children:[(0,u.jsx)("h3",{className:"text-12 font-m text-gray-6C6A7D mb-8",children:"Ù¾Ø±ÙØ±ÙØ´âØªØ±ÛÙ Ø§ÙØ§Ù
تگاÙâÙØ§"}),(0,u.jsx)("dl",{className:"flex flex-col gap-y-6 text-12",children:C.byResidence.slice(0,8).map(function(e){return(0,u.jsx)(k,{label:"".concat(e.name," (").concat((0,v.N)(e.publicId),")"),value:"".concat((0,v.N)(e.uses)," بار")},e.residenceId)})})]}),C.byReservationState.length>0&&(0,u.jsxs)("div",{className:"mt-16",children:[(0,u.jsx)("h3",{className:"text-12 font-m text-gray-6C6A7D mb-8",children:"ÙØ¶Ø¹Ûت رزرÙÙØ§"}),(0,u.jsx)("dl",{className:"flex flex-col gap-y-6 text-12",children:C.byReservationState.map(function(e){return(0,u.jsx)(k,{label:null!==(o=y.ZB[e.state])&&void 0!==o?o:e.state,value:(0,v.N)(e.count)},e.state)})})]}),(0,u.jsxs)("p",{className:"mt-14 text-11 text-gray-9B9BAA",children:["آخرÛÙ Ø§Ø³ØªÙØ§Ø¯Ù: ",C.lastUsedAt?(0,v.IY)(C.lastUsedAt):"â"]})]})]})})}function F(e){var n,t=e.rows,s=(0,l.Z)((0,d.useState)(!1),2),a=s[0],i=s[1],r=a?t:t.slice(0,6);return(0,u.jsx)(v.Zb,{children:(0,u.jsx)(b.$0,{title:"ØªØ§Ø±ÛØ®Ú٠تغÛÛØ±Ø§Øª",children:0===t.length?(0,u.jsx)("p",{className:"text-13 text-gray-9B9BAA",children:"ÙÙÙØ² تغÛÛØ±Û ثبت ÙØ´Ø¯Ù."}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("ol",{className:"flex flex-col gap-y-12",children:r.map(function(e){return(0,u.jsxs)("li",{className:"border-r-2 border-gray-E5E5E6 pr-10",children:[(0,u.jsx)("p",{className:"text-12 leading-20 text-black",children:e.summary}),(0,u.jsxs)("p",{className:"mt-2 text-11 text-gray-9B9BAA",children:[null!==(n=e.actorName)&&void 0!==n?n:"Ø³ÛØ³ØªÙ
"," \xb7 ",(0,v.IY)(e.createdAt)]})]},e.id)})}),t.length>6&&(0,u.jsx)(v.zx,{variant:"ghost",type:"button",className:"mt-10",onClick:function(){return i(function(e){return!e})}
1,children:a?"Ú©Ù
تر":"ÙÙ
Ø§ÛØ´ ÙÙ
Ù (".concat((0,v.N)(t.length),")")})]})})})}}},function(e){e.O(0,[4885,9791,8289,9759,5107,9774,2888,179],function(){return e(e.s=17838)}),_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.