import{_ as A}from"./EmptyStateBlock-D6U_EDq6.js";import{_ as T}from"./TotalAmount.vue_vue_type_script_setup_true_lang-GfTe3s0M.js";import{_ as K}from"./BlockOrderPayBalance-C1k6h3Ad.js";import{_ as N}from"./ClausesKeeper-DVJgfLR3.js";import{_ as U}from"./ButtonDefault-CghIUDY0.js";import{g as j,_ as F}from"./BlockBalanceAgreement-2iQbaweR.js";import{r as B,O as H,f as u,g as M,H as q,s as z,D as h,c as r,b as m,a as e,t as D,C as p,h as C,F as O,i as G,d as J,o}from"./index-CipWZKo_.js";import{u as Q}from"./contracts-CILh9uSu.js";import{_ as W}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./bootstrap-vue-next-3DpAa4tb.js";import"./component-DWBAga-C.js";import"./global-Fil99La8.js";import"./IconCross-C6IvNpdZ.js";import"./IconClose-ChC2G6HM.js";const X={key:0},Y={class:"section"},Z={class:"container"},ee={class:"section-header"},te={class:"tw-flex tw-items-center tw-justify-between tw-gap-2 tw-w-full tw-mb-2"},se={class:"section-label"},ae={class:"section"},oe={class:"container"},ne={class:"tw-p-3 md:tw-p-6 tw-border tw-border-gray-200 tw-rounded tw-mt-8"},le={class:"tw-flex tw-flex-wrap tw-gap-6 tw-mt-2"},re={class:"tw-text-gray-500 tw-text-xs"},ce={class:"tw-text-gray-800 tw-text-sm"},ie={key:0,class:"section"},de={class:"container"},ue={key:1,class:"section"},_e={class:"container"},me={key:1,class:"section"},ve={class:"container"},pe={__name:"DSOrderPayId",async setup(fe){let c,i;const s=B(null),d=H(),S=Q(),P=M(),b=J(),v=B(!1),a=u(()=>Object.values(d.dsOrders).find(n=>n.OrderID==P.params.id)),_=u(()=>d.DSSchemes?.[a.value?.SchemeID]),f=u(()=>S.contractsList[a.value.ContractID]),k=u(()=>f.value?.Balance>s.value?.price?"Оплатить c баланса договора":"Добавить в корзину"),$=u(()=>{const n=d.DSSchemes[a.value.SchemeID];return n?j(n):[]}),g=n=>{n.key==="Enter"&&n.ctrlKey&&!E.value&&y()},E=u(()=>s.value===null||s.value?.price===null);q(()=>{document.addEventListener("keyup",g)}),z(()=>{document.removeEventListener("keyup",g)});function y(){v.value=!0,d.DSOrderPay({DSOrderID:a.value?.ID,DaysPay:s.value?.actualDays,IsChange:!0}).then(n=>{let{result:t,error:x}=n;t==="SUCCESS"?b.push("/DSOrders"):t==="BASKET"&&b.push("/Basket"),v.value=!1})}return[c,i]=h(()=>d.fetchDSOrders()),await c,i(),[c,i]=h(()=>d.fetchDSSchemes()),await c,i(),[c,i]=h(()=>S.fetchContracts()),await c,i(),(n,t)=>{const x=F,I=U,L=N,V=K,R=T,w=A;return o(),r(O,null,[m(x),a.value&&a.value.ID&&_.value?.ID?(o(),r("div",X,[e("div",Y,[e("div",Z,[e("div",ee,[e("div",te,[t[3]||(t[3]=e("h1",{class:"tw-text-xl sm:tw-text-4xl"},"Оплата заказа выделенного сервера",-1)),m(I,{class:"btn--wide",label:k.value,disabled:s.value===null||s.value.price===null,"is-loading":v.value,onClick:t[0]||(t[0]=l=>y())},null,8,["label","disabled","is-loading"])]),e("div",se,D(a.value.IP?`#${a.value.IP}`:""),1)]),m(L)])]),e("div",ae,[e("div",oe,[e("div",ne,[t[4]||(t[4]=e("div",{class:"tw-text-2xl"},"Конфигурация",-1)),e("div",le,[(o(!0),r(O,null,G($.value,l=>(o(),r("div",{class:"tw-space-y-1",key:l.label},[e("div",re,D(l.label),1),e("div",ce,D(l.text),1)]))),128))])]),f.value?(o(),p(V,{key:0,modelValue:s.value,"onUpdate:modelValue":t[1]||(t[1]=l=>s.value=l),contract:f.value,scheme:_.value,serviceID:4e4,daysRemainded:a.value?.DaysRemainded,order:a.value},null,8,["modelValue","contract","scheme","daysRemainded","order"])):C("",!0)])]),_.value?.IsPayed&&_.value?.IsProlong||!_.value?.IsPayed?(o(),r("div",ie,[e("div",de,[s.value?(o(),p(R,{key:0,tariff:s.value},null,8,["tariff"])):C("",!0),m(I,{class:"btn--wide",label:k.value,disabled:s.value===null||s.value.price===null,"is-loading":v.value,onClick:t[2]||(t[2]=l=>y())},null,8,["label","disabled","is-loading"])])])):(o(),r("div",ue,[e("div",_e,[m(w,{class:"no-margin",label:"Заказ нельзя продлить"})])]))])):(o(),r("div",me,[e("div",ve,[a.value?.ID?(o(),p(w,{key:0,label:"Заказ не может быть продлен"})):(o(),p(w,{key:1,label:"Заказ не найден"}))])]))],64)}}},$e=W(pe,[["__scopeId","data-v-65ea81ca"]]);export{$e as default};
