import{_ as $}from"./EmptyStateBlock-Dt7jmbAi.js";import{_ as T}from"./BlueButton.vue_vue_type_script_setup_true_lang-CY8chwQm.js";import{_ as A}from"./TotalAmount.vue_vue_type_script_setup_true_lang-BCu2SNOJ.js";import{_ as K}from"./BlockOrderPay-BP1936HA.js";import{_ as R}from"./ClausesKeeper-CyJ_9bTp.js";import{_ as U}from"./BlockBalanceAgreement-396E9Da8.js";import{r as h,J as j,g as u,l as F,D as J,x as M,o as s,c as i,b as v,a as r,t as d,m,i as b,w as q,F as k,h as z,e as G,j as H,f as Q}from"./index-Bb2UEb_P.js";import{u as W}from"./index-Dax_IkAt.js";import{e as X}from"./common-U_VzDrmL.js";import{_ as Y}from"./_plugin-vue_export-helper-DlAUqK2U.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 Z={class:"tw-px-4 md:tw-px-8"},ee={key:0},te={class:"tw-text-gray-500 tw-text-sm tw-mt-2"},ae={key:1,class:"tw-mb-6"},se={class:"tw-p-3 md:tw-p-6 tw-border tw-border-gray-200 tw-rounded tw-mt-8"},oe={class:"tw-flex tw-flex-wrap tw-gap-6 tw-mt-2"},re={class:"tw-text-gray-500 tw-text-xs"},ne={class:"tw-text-gray-800 tw-text-sm"},le={__name:"DSOrderPayId",async setup(ce){let f,y;const t=h(null),n=j(),g=W(),I=H(),w=G(),p=h(!1),a=u(()=>Object.values(n.dsOrders).find(e=>e.OrderID==Number(I.params.id))),l=u(()=>n.DSSchemes?.[a.value?.SchemeID]),_=u(()=>g.contractsList[a.value?.ContractID]),B=u(()=>_.value?.Balance>t.value?.price?"Оплатить с баланса договора":"Добавить в корзину"),C=u(()=>{const e=n.DSSchemes[a.value.SchemeID];return e?X(e):[]}),S=e=>{e.key==="Enter"&&e.ctrlKey&&!O.value&&D()},O=u(()=>t.value===null||t.value?.price===null);F(()=>{document.addEventListener("keyup",S)}),J(()=>{document.removeEventListener("keyup",S)});async function D(){p.value=!0;const{result:e}=await n.DSOrderPay({DSOrderID:a.value?.ID,DaysPay:t.value?.actualDays,IsChange:!0});e==="SUCCESS"?w.push("/DSOrders"):e==="BASKET"&&w.push("/Basket"),p.value=!1}return[f,y]=M(()=>Promise.all([n.fetchDSOrders(),n.fetchDSSchemes()])),await f,y(),(e,o)=>{const P=U,E=R,V=K,L=A,N=T,x=$;return s(),i(k,null,[v(P,{"contract-id":a.value?.ContractID},null,8,["contract-id"]),r("div",Z,[a.value&&l.value?(s(),i("div",ee,[o[3]||(o[3]=r("h1",{class:"tw-w-full"},"Оплата заказа выделенного сервера",-1)),r("div",te," #"+d(a.value.OrderID)+" / "+d(a.value.IP)+" / "+d(l.value.Name),1),v(E),_.value?(s(),m(V,{key:0,modelValue:t.value,"onUpdate:modelValue":o[0]||(o[0]=c=>t.value=c),contract:_.value,scheme:l.value,"service-id":4e4,"days-remainded":a.value.DaysRemainded,order:a.value},null,8,["modelValue","contract","scheme","days-remainded","order"])):b("",!0),l.value.IsPayed&&l.value.IsProlong||!l.value.IsPayed?(s(),i("div",ae,[t.value?(s(),m(L,{key:0,tariff:t.value},null,8,["tariff"])):b("",!0),v(N,{class:"tw-w-full",disabled:t.value===null||t.value.price===null,loading:p.value,onClick:o[1]||(o[1]=c=>D())},{default:q(()=>[Q(d(B.value),1)]),_:1},8,["disabled","loading"]),r("div",se,[o[2]||(o[2]=r("div",{class:"tw-text-2xl"},"Конфигурация",-1)),r("div",oe,[(s(!0),i(k,null,z(C.value,c=>(s(),i("div",{key:c.label,class:"tw-space-y-1"},[r("div",re,d(c.label),1),r("div",ne,d(c.text),1)]))),128))])])])):(s(),m(x,{key:2,label:"Заказ нельзя продлить",class:"tw-my-8"}))])):(s(),m(x,{key:1,label:"Заказ не найден",class:"tw-my-8"}))])],64)}}},Ce=Y(le,[["__scopeId","data-v-6bfff12b"]]);export{Ce as default};
