import{_ as L}from"./EmptyStateBlock-Dt7jmbAi.js";import{_ as N}from"./BlueButton.vue_vue_type_script_setup_true_lang-CY8chwQm.js";import{_ as $}from"./TotalAmount.vue_vue_type_script_setup_true_lang-BCu2SNOJ.js";import{_ as T}from"./BlockOrderPay-BP1936HA.js";import{_ as A}from"./ClausesKeeper-CyJ_9bTp.js";import{_ as K}from"./BlockBalanceAgreement-396E9Da8.js";import{C as R,r as w,g as l,l as U,D as j,x as F,o,c as d,b as p,a as _,t as c,m as u,i as D,w as H,F as M,e as q,j as z,f as G}from"./index-Bb2UEb_P.js";import{u as J}from"./index-Dax_IkAt.js";import{_ as Q}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./common-U_VzDrmL.js";import"./bootstrap-vue-next-C0pyDr3k.js";import"./component-C-Q4t0gB.js";import"./global-BK91p1BE.js";import"./IconHelp-wlsb2dRe.js";import"./IconCross-Cfk4fnHT.js";import"./HtmlContent-DrkJBX3e.js";import"./IconCloseCircle-ctElXVvc.js";import"./clauses-Bhz_DuFa.js";import"./ButtonDefault-CzWpVlv6.js";const W={class:"tw-px-4 md:tw-px-8"},X={key:0},Y={class:"tw-text-gray-500 tw-text-sm tw-mt-2"},Z={key:1,class:"tw-mb-6"},ee={__name:"VPSOrderPayId",async setup(te){let v,f;const n=R(),I=J(),y=q(),h=z(),t=w(null),m=w(!1),e=l(()=>Object.values(n.vpsList).find(a=>a.OrderID===Number(h.params.id))),i=l(()=>I.contractsList[e.value?.ContractID]),s=l(()=>n.vpsSchemes?.[e.value?.SchemeID]),C=l(()=>i.value?.Balance>t.value?.price?"Оплатить с баланса договора":"Добавить в корзину");async function S(){m.value=!0;const{result:a}=await n.VPSOrderPay({VPSOrderID:e.value?.ID,DaysPay:t.value?.actualDays,IsChange:!0});a==="SUCCESS"?y.push("/VPSOrders"):a==="BASKET"&&y.push("/Basket"),m.value=!1}const P=a=>{a.key==="Enter"&&a.ctrlKey&&!B.value&&S()},B=l(()=>t.value===null||e.value?.ContractID===null);return U(()=>{document.addEventListener("keyup",P)}),j(()=>{document.removeEventListener("keyup",P)}),[v,f]=F(()=>Promise.all([n.fetchVPS(),n.fetchVPSSchemes()])),await v,f(),(a,r)=>{const b=K,g=A,x=T,O=$,E=N,V=L;return o(),d(M,null,[p(b,{"contract-id":e.value?.ContractID},null,8,["contract-id"]),_("div",W,[e.value&&s.value?(o(),d("div",X,[r[2]||(r[2]=_("h1",{class:"tw-w-full"},"Оплата заказа VPS/VDS сервера",-1)),_("div",Y," #"+c(e.value.OrderID)+" / "+c(e.value.IP)+" / "+c(s.value.Name),1),p(g,{partition:"Header:/VPSSchemes"}),i.value?(o(),u(x,{key:0,modelValue:t.value,"onUpdate:modelValue":r[0]||(r[0]=k=>t.value=k),contract:i.value,scheme:s.value,"service-id":3e4,"days-remainded":e.value?.DaysRemainded,order:e.value},null,8,["modelValue","contract","scheme","days-remainded","order"])):D("",!0),s.value.IsPayed&&s.value.IsProlong||!s.value.IsPayed?(o(),d("div",Z,[t.value?(o(),u(O,{key:0,tariff:t.value},null,8,["tariff"])):D("",!0),p(E,{disabled:t.value===null||e.value?.ContractID===null,loading:m.value,class:"tw-w-full",onClick:r[1]||(r[1]=k=>S())},{default:H(()=>[G(c(C.value),1)]),_:1},8,["disabled","loading"])])):(o(),u(V,{key:2,label:"Заказ нельзя продлить",class:"tw-my-8"}))])):(o(),u(V,{key:1,label:"Заказ VPS/VDS сервера не найден",class:"tw-my-8"}))])],64)}}},ke=Q(ee,[["__scopeId","data-v-737a8394"]]);export{ke as default};
