import{_ as R}from"./EmptyStateBlock-Dt7jmbAi.js";import{_ as J}from"./ButtonDefault-CzWpVlv6.js";import{_ as q}from"./TotalAmount.vue_vue_type_script_setup_true_lang-BCu2SNOJ.js";import{_ as z}from"./BlockOrderPay-BP1936HA.js";import{_ as G}from"./BlockSelectContract-DnFSm1Pw.js";import{_ as H}from"./ClausesKeeper-CyJ_9bTp.js";import{_ as Q}from"./BlockBalanceAgreement-396E9Da8.js";import{J as W,r as v,g as r,l as X,D as Y,x as Z,o as c,c as p,b as _,a as s,F as g,t as h,h as ee,m as E,i as V,e as te,j as se}from"./index-Bb2UEb_P.js";import{u as ae}from"./index-Dax_IkAt.js";import{u as oe}from"./services-DEZoSah0.js";import{e as re}from"./common-U_VzDrmL.js";import{_ as le}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"./multiselect-Bk-p1X5E.js";import"./HtmlContent-DrkJBX3e.js";import"./IconCloseCircle-ctElXVvc.js";import"./clauses-Bhz_DuFa.js";const ne={class:"tw-px-4 md:tw-px-8"},ce={class:"tw-text-xl sm:tw-text-4xl"},ie={class:"tw-p-3 md:tw-p-6 tw-border tw-border-gray-200 tw-rounded tw-mt-4"},ue={class:"tw-flex tw-flex-wrap tw-gap-6 tw-mt-2"},de={class:"tw-text-gray-500 tw-text-xs"},me={class:"tw-text-gray-800 tw-text-sm"},ve={class:"tw-my-6"},pe={key:1,class:"section"},_e={__name:"DSSchemesId",async setup(Se){let k,B;const L=ae(),l=W(),y=oe(),I=se(),S=te(),a=v(null),u=v([]),x=v(!1),n=v(null),$=v(!1),A=r(()=>a.value===null||n.value===null),f=r(()=>L.contractsList[n.value]),U=r(()=>{const t=l.DSSchemes?.[I.params.id];return t?re(t):[]}),d=r(()=>l.DSSchemes?.[I.params.id]),N=r(()=>y?.ServicesList),F=r(()=>{let t=0;return u.value.forEach(e=>{t+=Number(e?.Price)}),t}),K=r(()=>Object.values(l.dsOrders).find(t=>t.SchemeID==I.params.id&&t.ContractId==f.value.ID)),T=r(()=>$.value||f.value?.Balance>Number(d.value?.CostInstall)+a.value?.CostPay+F.value?"Оплатить с баланса договора":"Добавить в корзину");async function j(t){if(!(!u.value||u.value.length===0))for(const e of u.value){let i=N.value[e.ServiceID]?.Code;const{result:C,info:D}=await y.ServiceOrder({...e,Code:i,DependOrderID:t,ContractID:n.value});if(C==="SUCCESS"){let m={};i==="Default"?m.ServiceOrderID=D?.ServiceOrderID:m[`${i}OrderID`]=D?.ServiceOrderID;const b=await y.serviceOrderPay(i,m);let{result:w}=b;w==="SUCCESS"?S.push("/AdditionalServices"):w==="BASKET"&&S.push("/Basket")}else break}}async function O(){x.value=!0;const t=await l.DSOrder({ContractID:n.value,DSSchemeID:d.value.ID});if(t.result==="SUCCESS"){await j(t.info?.OrderID);const e=await l.DSOrderPay({DSOrderID:t.info?.DSOrderID,DaysPayFromBallance:a.value?.daysFromBalance||0,DaysPay:a.value?.actualDays,IsChange:!0});e.result==="SUCCESS"?S.push("/DSOrders"):e.result==="BASKET"&&S.push("/Basket")}x.value=!1}const P=t=>{t.key==="Enter"&&t.ctrlKey&&!A.value&&O()};return X(()=>{document.addEventListener("keyup",P)}),Y(()=>{document.removeEventListener("keyup",P)}),[k,B]=Z(()=>Promise.all([l.fetchDSOrders(),l.fetchDSSchemes()])),await k,B(),(t,e)=>{const i=Q,C=H,D=G,m=z,b=q,w=J,M=R;return c(),p(g,null,[_(i),s("div",ne,[d.value?.ID?(c(),p(g,{key:0},[s("h1",ce,h(d.value?.Name),1),e[4]||(e[4]=s("div",{class:"tw-text-sm tw-text-gray-500 tw-mt-1"},"Выделенный сервер",-1)),_(C),s("div",ie,[e[3]||(e[3]=s("div",{class:"tw-text-2xl"},"Конфигурация",-1)),s("div",ue,[(c(!0),p(g,null,ee(U.value,o=>(c(),p("div",{key:o.label,class:"tw-space-y-1"},[s("div",de,h(o.label),1),s("div",me,h(o.text),1)]))),128))])]),e[5]||(e[5]=s("div",{class:"section"},[s("div",{class:"section-subtitle"},"Что входит в стоимость"),s("div",{class:"text"},[s("p",null,"Для подключения дополнительных услуг"),s("ul",null,[s("li",null,"Размещение в РФ, Москва"),s("li",null,"IP адрес, с возможностью расширения"),s("li",null,"Бесплатная панель управления ISPManager Lite"),s("li",null,"Круглосуточная поддержка")])])],-1)),_(D,{modelValue:n.value,"onUpdate:modelValue":e[0]||(e[0]=o=>n.value=o),title:"Оформление услуги"},null,8,["modelValue"]),f.value?(c(),E(m,{key:0,modelValue:a.value,"onUpdate:modelValue":e[1]||(e[1]=o=>a.value=o),contract:f.value,scheme:d.value,"service-id":4e4,order:K.value},null,8,["modelValue","contract","scheme","order"])):V("",!0),s("div",ve,[a.value?(c(),E(b,{key:0,tariff:a.value,"additional-services":u.value},null,8,["tariff","additional-services"])):V("",!0),_(w,{class:"btn--wide",label:T.value,disabled:a.value===null||n.value===null,"is-loading":x.value,onClick:e[2]||(e[2]=o=>O())},null,8,["label","disabled","is-loading"])])],64)):(c(),p("div",pe,[_(M,{label:"Сервер не найден"})]))])],64)}}},Fe=le(_e,[["__scopeId","data-v-ffe57876"]]);export{Fe as default};
