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