import{_ as O}from"./EmptyStateBlock-Dt7jmbAi.js";import{_ as A}from"./ButtonDefault-CzWpVlv6.js";import{_ as N}from"./TotalAmount.vue_vue_type_script_setup_true_lang-BCu2SNOJ.js";import{_ as E}from"./ClausesKeeper-CyJ_9bTp.js";import{_ as $}from"./BlockBalanceAgreement-396E9Da8.js";import{N as L,r as F,g as d,x as p,l as T,D as K,o,c as s,b as m,a as e,t as x,i as D,m as g,F as V,e as j,j as M}from"./index-Bb2UEb_P.js";import{u as R}from"./index-Dax_IkAt.js";import{_ as U}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./common-U_VzDrmL.js";import"./HtmlContent-DrkJBX3e.js";import"./IconCloseCircle-ctElXVvc.js";import"./clauses-Bhz_DuFa.js";const W={class:"tw-px-4 md:tw-px-8"},Y={key:0},Z={key:0,class:"tw-text-xl sm:tw-text-4xl"},q={key:1,class:"tw-text-xl sm:tw-text-4xl"},z={key:2,class:"tw-text-xl sm:tw-text-4xl"},G={class:"tw-text-gray-500 tw-text-sm tw-mt-2"},H={key:0,class:"tw-mt-4 tw-mb-6"},J={class:"domain-prolong__data"},Q={key:0,class:"form-field"},X=["value"],ee={class:"form-field"},te=["value"],ae={key:1,class:"form-field__msg"},oe={class:"form-field"},se=["value"],le={class:"domain-prolong__data"},ne={__name:"DomainOrderPayId",async setup(re){let r,i;const u=L(),v=R(),k=M(),f=j(),_=F(!1),t=d(()=>Object.values(u.domainsList).find(n=>n.OrderID==k.params.id)),l=d(()=>u.domainSchemes[t.value?.SchemeID]),S=d(()=>v.contractsList[t.value?.ContractID]),c=d(()=>t.value?.IsPayed?l.value.CostProlong+Number(t.value?.AdditionalCost?.Summ||0)||0:l.value.CostOrder+Number(t.value?.AdditionalCost?.Summ||0)),w=d(()=>S.value.Balance>c.value?"Оплатить с баланса договора":"Добавить в корзину");async function y(){_.value=!0;const n=await u.domainOrderPay({DomainOrderID:t.value?.ID,YearsPay:1});let{result:a}=n;a==="SUCCESS"?f.push("/DomainOrders"):a==="BASKET"&&f.push("/Basket"),_.value=!1}const b=n=>{n.key==="Enter"&&n.ctrlKey&&y()};return[r,i]=p(()=>u.fetchDomainOrders()),await r,i(),[r,i]=p(()=>u.fetchDomainSchemes()),await r,i(),[r,i]=p(()=>v.fetchContracts()),await r,i(),T(()=>{document.addEventListener("keyup",b)}),K(()=>{document.removeEventListener("keyup",b)}),(n,a)=>{const C=$,I=E,B=N,P=A,h=O;return o(),s(V,null,[m(C),e("div",W,[t.value?(o(),s("div",Y,[e("div",null,[t.value.StatusID==="Waiting"?(o(),s("h1",Z," Оплата заказа доменного имени ")):t.value.StatusID==="ForTransfer"?(o(),s("h1",q," Оплата переноса домена ")):(o(),s("h1",z," Оплата продления доменного имени ")),e("div",G,x(t.value?.DomainName?`#${t.value?.DomainName}.${t.value?.DomainZone}`:""),1)]),m(I),l.value?.IsPayed&&l.value?.IsProlong||!l.value?.IsPayed?(o(),s("div",H,[e("div",J,[t.value.StatusID==="Waiting"||t.value.StatusID==="ForTransfer"?(o(),s("label",Q,[a[1]||(a[1]=e("div",{class:"form-field__label"},"Стоимость заказа (в год)",-1)),e("input",{type:"text",placeholder:"0 руб",value:l.value?.CostOrder+" руб",disabled:""},null,8,X)])):D("",!0),e("label",ee,[a[2]||(a[2]=e("div",{class:"form-field__label"},"Стоимость продления (в год)",-1)),e("input",{type:"text",placeholder:"0 руб",value:l.value?.CostProlong+" руб",disabled:""},null,8,te)]),a[4]||(a[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?(o(),s("div",ae,[e("p",null,x(t.value?.AdditionalCost.Message),1)])):D("",!0),e("label",oe,[a[3]||(a[3]=e("div",{class:"form-field__label"},"Всего к оплате",-1)),e("input",{type:"text",placeholder:"0 руб",value:c.value,disabled:""},null,8,se)])]),e("div",le,[m(B,{tariff:{label:"1 год",price:c.value},price:c.value},null,8,["tariff","price"]),m(P,{class:"btn--wide",label:w.value,"is-loading":_.value,onClick:a[0]||(a[0]=ie=>y())},null,8,["label","is-loading"])])])):(o(),g(h,{key:1,class:"no-margin",label:"Заказ нельзя продлить"}))])):(o(),g(h,{key:1,label:"Заказ домена не найден"}))])],64)}}},De=U(ne,[["__scopeId","data-v-58a4dfe6"]]);export{De as default};
