import{_ as h}from"./ButtonDefault-CzWpVlv6.js";import{_ as A}from"./BasicInput-BG-lQkv5.js";import{_ as V}from"./InputSelectContract.vue_vue_type_script_setup_true_lang-Dll1Hpi-.js";import{N as T,A as M,r as i,g as r,l as O,D as x,o as m,c as u,a as o,b as d,F as B,h as U,t as f,i as L}from"./index-Bb2UEb_P.js";import{_ as j}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./component-C-Q4t0gB.js";import"./common-U_VzDrmL.js";import"./InputSelect.vue_vue_type_script_setup_true_lang-DDGr1dhD.js";import"./IconChevronDown-NfcUpI8U.js";import"./index-Dax_IkAt.js";const F={class:"tw-mt-4"},R={class:"tw-h-32 sm:tw-h-64 tw-overflow-y-scroll tw-mt-4"},$={key:0,class:"domain__grid"},K={class:"domain__info-wrapper"},W={class:"domain__info-wrapper-vertical"},Y={class:"domain__info-wrapper"},Z={class:"domain__info-title"},H={class:"domain__package-name"},P={class:"domain__info-wrapper"},q={class:"domain__price"},z={__name:"ModalWindowDomainTransfer",props:["data"],emits:["modalClose"],setup(G,{emit:I}){const S=I,c=T(),_=M("emitter"),n=i(""),l=i(null),p=i(""),v=i(!1),s=r(()=>c?.domainSchemes),N=r(()=>Object.keys(s.value).map(e=>s.value[e]).find(e=>e.Name===n.value?.split(".")?.[1])?.ID),g=r(()=>Object.keys(s.value).map(e=>s.value[e]).find(e=>e.Name===n.value?.split(".")?.[1])?.DaysAfterTransfer),k=r(()=>Object.keys(s.value).map(e=>s.value[e]).find(e=>e.Name===n.value?.split(".")?.[1])?.DaysBeforeTransfer);function E(){S("modalClose")}async function D(){v.value=!0;const{result:e}=await c.checkDomainTransfer({ContractID:l.value||null,DomainName:n.value||null,StepID:1});if(e==="SUCCESS"){const{result:a}=await c.domainTransfer({ContractID:l.value||null,DomainName:n.value.split(".")[0]||null,AuthInfo:p.value||"",DomainSchemeID:N.value||null,DomainZone:n.value.split(".")[1],DaysBeforeTransfer:k.value||null,DaysAfterTransfer:g.value||null});a==="SUCCESS"?(_.emit("updateDomainsList"),E()):_.emit("open-modal",{component:"Error",data:{msg:"Ошибка при переносе домена"}})}else _.emit("open-modal",{component:"Error",data:{msg:"Ошибка проверки домена перед переносом"}});v.value=!1}const y=e=>{e.key==="Enter"&&D()};return O(()=>{document.addEventListener("keyup",y)}),x(()=>{document.removeEventListener("keyup",y)}),(e,a)=>{const C=V,w=A,b=h;return m(),u("div",null,[a[4]||(a[4]=o("div",{class:"tw-text-2xl"},"Перенос домена",-1)),a[5]||(a[5]=o("div",{class:"tw-text-xs tw-text-gray-500 tw-mt-2"}," Домены в зонах ru/su/рф переносятся без дополнительных условий, во всех остальных зонах переносятся с оплатой продления на год. Ниже приведены цены на продление Вашего доменного имени. ",-1)),d(C,{modelValue:l.value,"onUpdate:modelValue":a[0]||(a[0]=t=>l.value=t),class:"tw-mt-4"},null,8,["modelValue"]),o("div",F,[d(w,{modelValue:n.value,"onUpdate:modelValue":a[1]||(a[1]=t=>n.value=t),label:"Доменное имя",placeholder:"yourDomain.ru",necessarily:!0},null,8,["modelValue"]),d(w,{modelValue:p.value,"onUpdate:modelValue":a[2]||(a[2]=t=>p.value=t),label:"Ключ переноса домена (AuthInfo)",placeholder:""},null,8,["modelValue"])]),o("div",R,[s.value?(m(),u("div",$,[(m(!0),u(B,null,U(s.value,t=>(m(),u("div",{key:t.ID,class:"domain__item domain__item_inactive"},[o("div",K,[o("div",W,[o("div",Y,[o("div",Z,"."+f(t?.Name),1)]),o("div",H,f(t?.PackageID),1)])]),o("div",P,[o("div",q,f(t?.CostTransfer)+" ₽",1)])]))),128))])):L("",!0)]),d(b,{class:"domain__transfer-item",label:"Перенести","is-loading":v.value,disabled:n.value?.length<=0,onClick:a[3]||(a[3]=t=>D())},null,8,["is-loading","disabled"])])}}},ie=j(z,[["__scopeId","data-v-ac5b47a3"]]);export{ie as default};
