PageSourceSearch

https://lidomatrip.com/_next/static/chunks/pages/admin/settings-de979b9fc9691419.js

js lidomatrip.com collected 2026-10-02 20:26:12 UTC 14,686 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[577],{29217:function(e,a,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/settings",function(){return n(75256)}])},75256:function(e,a,n){"use strict";n.r(a),n.d(a,{default:function(){return p}});var t=n(85893),l=n(67294),s=n(41664),i=n.n(s),r=n(44389),c=n(49759),d=n(84858),o=n(32474);let x=[{key:"amenities",label:"امکانات"},{key:"rules",label:"قوانین و مقررات"},{key:"peak",label:"روزهای پیک"}],m=[{value:"",label:"همه نوع اقامتگاه"},{value:"BOOMGARDI",label:"فقط اتاق‌های بوم‌گردی"},{value:"SUIT",label:"فقط ویلا و سوئیت"},{value:"HOTEL",label:"فقط هتل"}],h={BOOMGARDI:"بوم‌گردی",SUIT:"ویلا/سوئیت",HOTEL:"هتل"},g=[{value:"SWITCH",label:"کلید (دارد / ندارد)"},{value:"DROPDOWN",label:"لیست کشویی"},{value:"TEXT",label:"متن آزاد"},{value:"CHECKBOX",label:"چک‌باکس"}];function p(){let[e,a]=(0,l.useState)("amenities");return(0,t.jsxs)(c.Z,{title:"تنظیمات",breadcrumb:(0,t.jsx)(i(),{href:"/admin",children:"داشبورد"}),toolbar:(0,t.jsxs)(o.Zb,{className:"px-8 py-6 flex items-center gap-x-4 overflow-x-auto",children:[x.map(n=>(0,t.jsx)("button",{onClick:()=>a(n.key),"aria-pressed":e===n.key,className:`px-14 py-8 rounded-10 text-13 leading-20 font-m whitespace-nowrap transition ${e===n.key?"bg-primary-main text-white":"text-gray-6C6A7D hover:bg-gray-F0F0F0"}`,children:n.label},n.key)),(0,t.jsx)(i(),{href:"/admin/settings/reservations",className:"px-14 py-8 rounded-10 text-13 leading-20 font-m whitespace-nowrap text-gray-6C6A7D hover:bg-gray-F0F0F0",children:"تنظیمات رزرواسیون"}),(0,t.jsx)(i(),{href:"/admin/settings/payments",className:"px-14 py-8 rounded-10 text-13 leading-20 font-m whitespace-nowrap text-gray-6C6A7D hover:bg-gray-F0F0F0",children:"روش‌های پرداخت"}),(0,t.jsx)(i(),{href:"/admin/settings/locations",className:"px-14 py-8 rounded-10 text-13 leading-20 font-m whitespace-nowrap text-gray-6C6A7D hover:bg-gray-F0F0F0",children:"دسته‌بندی مکان‌ها"}),(0,t.jsx)(i(),{href:"/admin/settings/announcements",className:"px-14 py-8 rounded-10 text-13 leading-20 font-m whitespace-nowrap text-gray-6C6A7D hover:bg-gray-F0F0F0",children:"اطلاعیه‌ها"}),(0,t.jsx)(i(),{href:"/admin/settings/attractions",className:"px-14 py-8 rounded-10 text-13 leading-20 font-m whitespace-nowrap text-gray-6C6A7D hover:bg-gray-F0F0F0",children:"جاذبه‌های گردشگری"}),(0,t.jsx)(i(),{href:"/admin/settings/tags",className:"px-14 py-8 rounded-10 text-13 leading-20 font-m whitespace-nowrap text-gray-6C6A7D hover:bg-gray-F0F0F0",children:"تگ‌های سئو"}),(0,t.jsx)(i(),{href:"/admin/settings/sitemap",className:"px-14 py-8 rounded-10 text-13 leading-20 font-m whitespace-nowrap text-gray-6C6A7D hover:bg-gray-F0F0F0",children:"sitemap و robots"}),(0,t.jsx)(i(),{href:"/admin/settings/faqs",className:"px-14 py-8 rounded-10 text-13 leading-20 font-m whitespace-nowrap text-gray-6C6A7D hover:bg-gray-F0F0F0",children:"سوالات متداول"}),(0,t.jsx)(i(),{href:"/admin/settings/home",className:"px-14 py-8 rounded-10 text-13 leading-20 font-m whitespace-nowrap text-gray-6C6A7D hover:bg-gray-F0F0F0",children:"صفحه اصلی"}),(0,t.jsx)(i(),{href:"/admin/settings/day-control",className:"px-14 py-8 rounded-10 text-13 leading-20 font-m whitespace-nowrap text-gray-6C6A7D hover:bg-gray-F0F0F0",children:"کنترل روزها"}),(0,t.jsx)(i(),{href:"/admin/settings/booking-mode",className:"px-14 py-8 rounded-10 text-13 leading-20 font-m whitespace-nowrap text-gray-6C6A7D hover:bg-gray-F0F0F0",children:"حالت رزرو"}),(0,t.jsx)(i(),{href:"/admin/settings/fallback-avatars",className:"px-14 py-8 rounded-10 text-13 leading-20 font-m whitespace-nowrap text-gray-6C6A7D hover:bg-gray-F0F0F0",children:"تصاویر جایگزین پروفایل"}),(0,t.jsx)(i(),{href:"/admin/settings/wizard",className:"px-14 py-8 rounded-10 text-13 leading-20 font-m whitespace-nowrap text-gray-6C6A7D hover:bg-gray-F0F0F0",children:"ثبت اقامتگاه"}),(0,t.jsx)(i(),{href:"/admin/settings/ai",className:"px-14 py-8 rounded-10 text-13 leading-20 font-m whitespace-nowrap text-gray-6C6A7D hover:bg-gray-F0F0F0",children:"هوش مصنوعی"}),(0,t.jsx)(i(),{href:"/admin/sales-channels/miaan",className:"px-14 py-8 rounded-10 text-13 leading-20 font-m whitespace-nowrap text-gray-6C6A7D hover:bg-gray-F0F0F0",children:"کانال‌های فروش"})]}),children:["amenities"===e&&(0,t.jsx)(u,{}),"rules"===e&&(0,t.jsx)(f,{}),"peak"===e&&(0,t.jsx)(v,{})]})}function u(){let{data:e,isLoading:a,mutate:n}=(0,r.u)("/api/admin/amenities",e=>(0,d.SC)(e)),[s,i]=(0,l.useState)(null),c=new Map;for(let a of e??[]){let e=a.category||"سایر";c.set(e,[...c.get(e)??[],a])}return a?(0,t.jsx)(o.Od,{className:"h-[300px]"}):(0,t.jsxs)("div",{className:"flex flex-col gap-y-16",children:[(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsxs)(o.zx,{onClick:()=>i("new"),children:[(0,t.jsx)("i",{className:"icon-Plus text-16"})," امکانات جدید"]})}),[...c.entries()].map(e=>{let[a,n]=e;return(0,t.jsxs)(o.Zb,{className:"p-20",children:[(0,t.jsx)("h3",{className:"text-16 leading-24 font-m text-black mb-12",children:a}),(0,t.jsx)("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-10",children:n.map(e=>(0,t.jsxs)("button",{onClick:()=>i(e),className:"flex items-center gap-x-10 p-10 rounded-10 border border-gray-E5E5E6 hover:border-primary-main transition text-right",children:[e.iconUrl?(0,t.jsx)("img",{src:e.iconUrl,alt:"",className:"w-20 h-20 shrink-0 opacity-70"}):(0,t.jsx)("i",{className:"icon-Possibilities text-18 text-gray-9B9BAA shrink-0"}),(0,t.jsxs)("span",{className:"flex-1 min-w-0",children:[(0,t.jsx)("span",{className:"block text-13 leading-20 text-black truncate",children:e.name}),(0,t.jsx)("span",{className:"block text-11 text-gray-9B9BAA truncate",children:e.key??"—"})]}),!!e.scope&&(0,t.jsx)(o.Ct,{tone:"yellow",children:h[e.scope]}),e.features.length>0&&(0,t.jsxs)(o.Ct,{tone:"blue",children:[(0,o.N)(e.features.length)," ویژگی"]})]},e.id))})]},a)}),!!s&&(0,t.jsx)(y,{amenity:"new"===s?null:s,onClose:()=>i(null),onSaved:()=>{i(null),n()}})]})}function y(e){let{amenity:a,onClose:n,onSaved:s}=e,[i,r]=(0,l.useState)({name:(null==a?void 0:a.name)??"",key:(null==a?void 0:a.key)??"",category:(null==a?void 0:a.category)??"",iconUrl:(null==a?void 0:a.iconUrl)??"",scope:(null==a?void 0:a.scope)??""}),[c,x]=(0,l.useState)((null==a?void 0:a.features)??[]),[h,p]=(0,l.useState)(!1),[u,y]=(0,l.useState)(null);async function f(e){e.preventDefault(),p(!0),y(null);try{let e={name:i.name,key:i.key||void 0,category:i.category||void 0,iconUrl:i.iconUrl||void 0,scope:i.scope||null,features:c.filter(e=>e.name.trim()).map(e=>({fieldType:e.fieldType,name:e.name,placeholder:e.placeholder||null,values:e.values||null}))};await (0,d.SC)(a?`/api/admin/amenities/${a.id}`:"/api/admin/amenities",{method:a?"PATCH":"POST",body:JSON.stringify(e)}),s()}catch(e){y(e instanceof Error?e.message:"خطا در ذخیره")}
1finally{p(!1)}}async function j(){a&&(await (0,d.SC)(`/api/admin/amenities/${a.id}`,{method:"DELETE"}),s())}return(0,t.jsx)(o.u_,{open:!0,onClose:n,title:a?`ویرایش ${a.name}`:"امکانات جدید",width:"max-w-[640px]",children:(0,t.jsxs)("form",{onSubmit:f,className:"flex flex-col gap-y-12",children:[(0,t.jsxs)("div",{className:"grid md:grid-cols-2 gap-12",children:[(0,t.jsx)(o.gN,{label:"نام",children:(0,t.jsx)(o.II,{value:i.name,onChange:e=>r(a=>({...a,name:e.target.value})),required:!0})}),(0,t.jsx)(o.gN,{label:"کلید انگلیسی (برای فیلترها)",children:(0,t.jsx)(o.II,{value:i.key,onChange:e=>r(a=>({...a,key:e.target.value})),placeholder:"pool"})}),(0,t.jsx)(o.gN,{label:"دسته‌بندی",children:(0,t.jsx)(o.II,{value:i.category,onChange:e=>r(a=>({...a,category:e.target.value})),placeholder:"امکانات"})}),(0,t.jsx)(o.gN,{label:"آدرس آیکون",children:(0,t.jsx)(o.II,{value:i.iconUrl,onChange:e=>r(a=>({...a,iconUrl:e.target.value})),placeholder:"/assets/amenity-icons/pool.svg"})}),(0,t.jsx)(o.gN,{label:"دامنه",hint:"محدود کردن این امکان به یک نوع اقامتگاه در ویزارد ثبت",children:(0,t.jsx)(o.Ph,{value:i.scope,onChange:e=>r(a=>({...a,scope:e.target.value})),children:m.map(e=>(0,t.jsx)("option",{value:e.value,children:e.label},e.value))})})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-8",children:[(0,t.jsx)("span",{className:"text-12 leading-18 text-gray-6C6A7D font-m",children:"ویژگی‌ها (فرم \xabویژگی ها\xbb در صفحه اقامتگاه)"}),(0,t.jsx)("button",{type:"button",onClick:()=>x(e=>[...e,{name:"",fieldType:"SWITCH",placeholder:null,values:"دارد, ندارد"}]),className:"text-12 font-m text-primary-dark",children:"+ افزودن ویژگی"})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-y-8 max-h-[240px] overflow-y-auto",children:[c.map((e,a)=>(0,t.jsxs)("div",{className:"grid grid-cols-[1fr_140px_1fr_28px] gap-x-8 items-center",children:[(0,t.jsx)(o.II,{value:e.name,placeholder:"نام ویژگی",onChange:e=>x(n=>n.map((n,t)=>t===a?{...n,name:e.target.value}:n))}),(0,t.jsx)(o.Ph,{value:e.fieldType,onChange:e=>x(n=>n.map((n,t)=>t===a?{...n,fieldType:e.target.value}:n)),children:g.map(e=>(0,t.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,t.jsx)(o.II,{value:e.values??"",placeholder:"گزینه‌ها با ویرگول",onChange:e=>x(n=>n.map((n,t)=>t===a?{...n,values:e.target.value}:n))}),(0,t.jsx)("button",{type:"button",onClick:()=>x(e=>e.filter((e,n)=>n!==a)),className:"w-28 h-28 rounded-8 text-[#E53935] hover:bg-[#FFEBEB]","aria-label":"حذف ویژگی",children:(0,t.jsx)("i",{className:"icon-Delete text-16"})})]},a)),0===c.length&&(0,t.jsx)("p",{className:"text-12 text-gray-9B9BAA",children:"ویژگی‌ای تعریف نشده"})]})]}),!!u&&(0,t.jsx)("p",{className:"text-13 text-[#C62828]",children:u}),(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[!!a&&(0,t.jsx)(o.zx,{type:"button",variant:"danger",onClick:j,children:"حذف"}),(0,t.jsxs)("div",{className:"flex items-center gap-x-10 mr-auto",children:[(0,t.jsx)(o.zx,{type:"button",variant:"secondary",onClick:n,children:"انصراف"}),(0,t.jsx)(o.zx,{type:"submit",disabled:h,children:h?"در حال ذخیره...":"ذخیره"})]})]})]})})}function f(){let{data:e,isLoading:a,mutate:n}=(0,r.u)("/api/admin/rules",e=>(0,d.SC)(e)),[s,i]=(0,l.useState)(null);return a?(0,t.jsx)(o.Od,{className:"h-[240px]"}):(0,t.jsxs)("div",{className:"flex flex-col gap-y-16",children:[(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsxs)(o.zx,{onClick:()=>i("new"),children:[(0,t.jsx)("i",{className:"icon-Plus text-16"})," قانون جدید"]})}),(0,t.jsxs)(o.Zb,{className:"p-20",children:[(0,t.jsx)("h3",{className:"text-16 leading-24 font-m text-black mb-12",children:"مقررات اقامتگاه"}),(null==e?void 0:e.length)===0&&(0,t.jsx)(o.ub,{text:"قانونی ثبت نشده"}),(0,t.jsx)("div",{className:"grid md:grid-cols-2 gap-10",children:null==e?void 0:e.map(e=>(0,t.jsxs)("button",{onClick:()=>i(e),className:"flex items-center gap-x-10 p-12 rounded-10 border border-gray-E5E5E6 hover:border-primary-main transition text-right",children:[(0,t.jsx)("i",{className:"icon-Rules text-18 text-gray-9B9BAA shrink-0"}),(0,t.jsxs)("span",{className:"flex-1 min-w-0",children:[(0,t.jsx)("span",{className:"block text-13 leading-20 text-black",children:e.name}),(0,t.jsx)("span",{className:"block text-11 text-gray-9B9BAA",children:e.key??"—"})]})]},e.id))})]}),!!s&&(0,t.jsx)(j,{rule:"new"===s?null:s,onClose:()=>i(null),onSaved:()=>{i(null),n()}})]})}function j(e){let{rule:a,onClose:n,onSaved:s}=e,[i,r]=(0,l.useState)({name:(null==a?void 0:a.name)??"",key:(null==a?void 0:a.key)??"",category:(null==a?void 0:a.category)??"مقررات اقامتگاه"}),[c,x]=(0,l.useState)(!1);return(0,t.jsx)(o.u_,{open:!0,onClose:n,title:a?`ویرایش ${a.name}`:"قانون جدید",children:(0,t.jsxs)("form",{onSubmit:async e=>{e.preventDefault(),x(!0);try{await (0,d.SC)(a?`/api/admin/rules/${a.id}`:"/api/admin/rules",{method:a?"PATCH":"POST",body:JSON.stringify({name:i.name,key:i.key||void 0,category:i.category||void 0})}),s()}finally{x(!1)}},className:"flex flex-col gap-y-12",children:[(0,t.jsx)(o.gN,{label:"متن قانون",children:(0,t.jsx)(o.II,{value:i.name,onChange:e=>r(a=>({...a,name:e.target.value})),required:!0})}),(0,t.jsx)(o.gN,{label:"کلید انگلیسی",children:(0,t.jsx)(o.II,{value:i.key,onChange:e=>r(a=>({...a,key:e.target.value})),placeholder:"pets"})}),(0,t.jsx)(o.gN,{label:"دسته‌بندی",children:(0,t.jsx)(o.II,{value:i.category,onChange:e=>r(a=>({...a,category:e.target.value}))})}),(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[!!a&&(0,t.jsx)(o.zx,{type:"button",variant:"danger",onClick:async()=>{await (0,d.SC)(`/api/admin/rules/${a.id}`,{method:"DELETE"}),s()},children:"حذف"}),(0,t.jsxs)("div",{className:"flex items-center gap-x-10 mr-auto",children:[(0,t.jsx)(o.zx,{type:"button",variant:"secondary",onClick:n,children:"انصراف"}
1),(0,t.jsx)(o.zx,{type:"submit",disabled:c,children:"ذخیره"})]})]})]})})}function v(){return(0,t.jsxs)(o.Zb,{className:"p-20",children:[(0,t.jsx)("h3",{className:"text-16 leading-24 font-m text-black mb-4",children:"روزهای پیک"}),(0,t.jsxs)("p",{className:"text-13 leading-22 text-gray-6C6A7D mb-6",children:["این بخش به ",(0,t.jsx)("span",{className:"font-m text-black",children:"کنترل روزها"})," منتقل شده است."]}),(0,t.jsx)("p",{className:"text-12 leading-20 text-gray-9B9BAA mb-16",children:"آنجا علاوه بر بازه‌های نرخ پیک، می‌توانید مشخص کنید هر بازه روی چه چیزی اعمال شود — همه‌ی اقامتگاه‌ها، شهر یا استان خاص، نوع اقامتگاه، امکانات، یا اقامتگاه‌های انتخابی — و چه چیزهایی از آن مستثنا باشند. روزهای تعطیل هم همان‌جاست."}),(0,t.jsxs)(i(),{href:"/admin/settings/day-control",className:"inline-flex items-center gap-x-8 px-14 py-8 rounded-10 bg-primary-main text-white text-13 leading-20 font-m",children:[(0,t.jsx)("i",{"aria-hidden":"true",className:"icon-CalendarFlash text-16"}),"رفتن به کنترل روزها"]})]})}}},function(e){e.O(0,[4389,9759,9774,2888,179],function(){return e(e.s=29217)}),_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.