import{_ as $}from"./EmptyStateBlock-Dt7jmbAi.js";import{_ as A}from"./TotalAmount.vue_vue_type_script_setup_true_lang-BCu2SNOJ.js";import{_ as V}from"./BlockOrderPay-BP1936HA.js";import{_ as L}from"./ClausesKeeper-CyJ_9bTp.js";import{_ as U}from"./ButtonDefault-CzWpVlv6.js";import{_ as j}from"./BlockBalanceAgreement-396E9Da8.js";import{r as N,g as p,l as M,x as S,o as c,c as b,b as _,a as i,F as B,t as R,m as D,i as I,e as T,j as E}from"./index-Bb2UEb_P.js";import{u as F}from"./index-Dax_IkAt.js";import{u as q}from"./services-DEZoSah0.js";import{_ as K}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";const z={class:"tw-px-4 md:tw-px-8 tw-mb-6"},G={class:"section-header"},H={class:"section-header__wrapper"},J={class:"section-label"},Q={__name:"DNSmanagerOrderPayId",async setup(W){let o,r;const g=F(),s=q(),C=E(),y=T(),a=N(null),m=N(!1),n=p(()=>Object.values(s.DNSmanagerOrdersList).find(t=>t.OrderID==C.params.id)),u=p(()=>g.contractsList[n.value.ContractID]),h=p(()=>u.value?.Balance>=a.value?.CostPay?"Оплатить с баланса договора":"Добавить в корзину"),d=p(()=>s?.additionalServicesScheme?.DNSmanager?Object.keys(s.additionalServicesScheme.DNSmanager).map(t=>{const e=s.additionalServicesScheme.DNSmanager[t];return{...e,value:e?.ID,name:e?.Name,cost:e?.CostDay,month:e?.CostMonth}}).filter(t=>t?.ID==n.value?.SchemeID):[]);async function k(){m.value=!0;const t=u.value.Balance>=a.value?.CostPay||d.value[0]?.cost==="0.00"&&d.value[0]?.month==="0.00",e=!t,v={DNSmanagerOrderID:n.value.ID,DaysPay:a.value?.actualDays,IsNoBasket:t,IsUseBasket:e,PayMessage:""},l=await s.DNSmanagerOrderPay(v);l==="UseBasket"?y.push("/Basket"):l==="NoBasket"?y.push("/AdditionalServices?ServiceID=52000"):console.error("Ошибка оплаты заказа"),m.value=!1}return M(()=>{s.fetchAdditionalServiceScheme("DNSmanager")}),[o,r]=S(()=>s.fetchDNSmanagerOrders()),await o,r(),[o,r]=S(()=>s.fetchAdditionalServiceScheme("DNSmanager")),await o,r(),[o,r]=S(()=>g.fetchContracts()),await o,r(),(t,e)=>{const v=j,l=U,w=L,O=V,P=A,x=$;return c(),b(B,null,[_(v),i("div",z,[n.value?(c(),b(B,{key:0},[i("div",G,[i("div",H,[e[3]||(e[3]=i("h1",{class:"section-title"},"Оплата заказа вторичного DNS",-1)),_(l,{class:"btn--wide",label:h.value,disabled:a.value===null||a.value?.price===null,"is-loading":m.value,onClick:e[0]||(e[0]=f=>k())},null,8,["label","disabled","is-loading"])]),i("div",J,R(d.value[0]?.Name),1)]),_(w),u.value?(c(),D(O,{key:0,modelValue:a.value,"onUpdate:modelValue":e[1]||(e[1]=f=>a.value=f),contract:u.value,"days-remainded":n.value?.DaysRemainded,"service-id":52e3,scheme:d.value[0],order:n.value},null,8,["modelValue","contract","days-remainded","scheme","order"])):I("",!0),a.value?(c(),D(P,{key:1,tariff:a.value},null,8,["tariff"])):I("",!0),_(l,{class:"btn--wide",label:h.value,disabled:a.value===null||a.value?.price===null,"is-loading":m.value,onClick:e[2]||(e[2]=f=>k())},null,8,["label","disabled","is-loading"])],64)):(c(),D(x,{key:1,label:"Заказ нельзя продлить"}))])],64)}}},fe=K(Q,[["__scopeId","data-v-20e374d7"]]);export{fe as default};
