import{_ as B}from"./EmptyStateBlock-D6U_EDq6.js";import{_ as O}from"./ButtonDefault-CghIUDY0.js";import{_ as E}from"./TotalAmount.vue_vue_type_script_setup_true_lang-GfTe3s0M.js";import{_ as N}from"./ClausesKeeper-DVJgfLR3.js";import{_ as $}from"./BlockBalanceAgreement-2iQbaweR.js";import{Q as L,r as T,f as u,g as w,D as m,H as K,s as R,c as l,b as c,a as e,t as b,F as C,h as S,d as V,x as j,o as n}from"./index-CipWZKo_.js";import{u as M}from"./contracts-CILh9uSu.js";import{_ as U}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./IconClose-ChC2G6HM.js";const W={key:0,class:"domain-scheme"},H={class:"section"},Q={class:"container"},Z={class:"section-header"},q={key:0,class:"section-title"},z={key:1,class:"section-title"},G={key:2,class:"section-title"},J={class:"section-label"},X={class:"section"},Y={class:"container"},ee={class:"domain-prolong__data"},te={key:0,class:"form-field"},oe=["value"],se={class:"form-field"},ae=["value"],le={key:1,class:"form-field__msg"},ne={class:"form-field"},ie=["value"],re={class:"section"},ce={class:"container"},de={class:"domain-prolong__data"},ue={key:1,class:"section"},_e={class:"container"},me={key:1,class:"section"},ve={class:"container"},pe={__name:"DomainProlong",async setup(fe){let i,r;const d=L(),v=M(),k=w(),p=V();j("emitter");const _=T(!1),f=u(()=>t.value.isPayed?parseFloat(s.value.CostProlong)+parseFloat(t.value.AdditionalCost?.Summ||0)||0:parseFloat(s.value.CostOrder)+parseFloat(t.value.AdditionalCost?.Summ||0)),F=u(()=>{let a=0;return t.StatusID==="ClaimForRegister"?a=+s?.CostOrder+Number(t?.AdditionalCost?.Summ||0):a=+s?.CostProlong+Number(t?.AdditionalCost?.Summ||0),I.Balance>a?"Оплатить c баланса договора":"Добавить в корзину"});function h(){_.value=!0,d.DomainOrderPay({DomainOrderID:t.value?.ID,DaysToProlong:s.value?.DaysToProlong}).then(a=>{let{result:o,error:g}=a;o==="SUCCESS"?p.push("/DomainOrders"):o==="BASKET"&&p.push("/Basket"),_.value=!1})}const y=a=>{a.key==="Enter"&&a.ctrlKey&&h()},t=u(()=>Object.values(d?.domainsList).find(a=>a.OrderID==k.params.id)),s=u(()=>d?.domainSchemes[t.value?.SchemeID]),I=u(()=>v.contractsList[t.value?.ContractID]);return[i,r]=m(()=>d.fetchDomainOrders()),await i,r(),[i,r]=m(()=>d.fetchDomainSchemes()),await i,r(),[i,r]=m(()=>v.fetchContracts()),await i,r(),K(()=>{document.addEventListener("keyup",y)}),R(()=>{document.removeEventListener("keyup",y)}),(a,o)=>{const g=$,P=N,A=E,x=O,D=B;return n(),l(C,null,[c(g),t.value?(n(),l("div",W,[e("div",H,[e("div",Q,[e("div",Z,[t.value.StatusID==="Waiting"?(n(),l("h1",q,"Оплата заказа доменного имени")):t.value.StatusID==="ForTransfer"?(n(),l("h1",z,"Оплата переноса домена")):(n(),l("h1",G,"Оплата продления доменного имени")),e("div",J,b(t.value?.DomainName?`#${t.value?.DomainName}.${t.value?.DomainZone}`:""),1)]),c(P)])]),s.value?.IsPayed&&s.value?.IsProlong||!s.value?.IsPayed?(n(),l(C,{key:0},[e("div",X,[e("div",Y,[e("div",ee,[t.value.StatusID==="Waiting"||t.value.StatusID==="ForTransfer"?(n(),l("label",te,[o[1]||(o[1]=e("div",{class:"form-field__label"},"Стоимость заказа (в год)",-1)),e("input",{type:"text",placeholder:"0 руб",value:s.value?.CostOrder+" руб",disabled:""},null,8,oe)])):S("",!0),e("label",se,[o[2]||(o[2]=e("div",{class:"form-field__label"},"Стоимость продления (в год)",-1)),e("input",{type:"text",placeholder:"0 руб",value:s.value?.CostProlong+" руб",disabled:""},null,8,ae)]),o[4]||(o[4]=e("label",{class:"form-field"},[e("div",{class:"form-field__label"},"Количество лет"),e("input",{type:"text",placeholder:"1",value:"1",disabled:""})],-1)),t.value?.AdditionalCost?(n(),l("div",le,[e("p",null,b(t.value?.AdditionalCost.Message),1)])):S("",!0),e("label",ne,[o[3]||(o[3]=e("div",{class:"form-field__label"},"Всего к оплате",-1)),e("input",{type:"text",placeholder:"0 руб",value:t.value.IsPayed?(parseFloat(s.value?.CostProlong)+parseFloat(t.value?.AdditionalCost?.Summ||0)).toFixed(2)+" руб":(parseFloat(s.value?.CostOrder)+parseFloat(t.value?.AdditionalCost?.Summ||0)).toFixed(2)+" руб",disabled:""},null,8,ie)])])])]),e("div",re,[e("div",ce,[e("div",de,[c(A,{tariff:{label:"1 год",price:f.value},price:f.value},null,8,["tariff","price"]),c(x,{class:"btn--wide",label:F.value,onClick:o[0]||(o[0]=he=>h()),"is-loading":_.value},null,8,["label","is-loading"])])])])],64)):(n(),l("div",ue,[e("div",_e,[c(D,{class:"no-margin",label:"Заказ нельзя продлить"})])]))])):(n(),l("div",me,[e("div",ve,[c(D,{label:"Заказ домена не найден"})])]))],64)}}},Pe=U(pe,[["__scopeId","data-v-044b5b69"]]);export{Pe as default};
