import{_ as U}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 E}from"./BlockOrderPay-BP1936HA.js";import{_ as L}from"./InputSelectService-CZ0-qM8M.js";import{_ as T}from"./InputSelectContract.vue_vue_type_script_setup_true_lang-Dll1Hpi-.js";import{_ as F}from"./ClausesKeeper-CyJ_9bTp.js";import{_ as H}from"./TabsAdditionalServices-Q4t33JY-.js";import{_ as K}from"./BlockBalanceAgreement-396E9Da8.js";import{r as m,g as _,v as M,x as R,o as p,c as P,b as l,a as o,t as x,f as y,B as j,m as D,i as v,w as q,F as z,e as G}from"./index-Bb2UEb_P.js";import{u as J}from"./index-Dax_IkAt.js";import{u as Q}from"./services-DEZoSah0.js";import"./_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"./BasicInput-BG-lQkv5.js";import"./InputSelect.vue_vue_type_script_setup_true_lang-DDGr1dhD.js";import"./IconChevronDown-NfcUpI8U.js";import"./HtmlContent-DrkJBX3e.js";import"./IconCloseCircle-ctElXVvc.js";import"./clauses-Bhz_DuFa.js";import"./server-KemHlIfj.js";import"./multiselect-Bk-p1X5E.js";import"./ButtonDefault-CzWpVlv6.js";const W={class:"tw-px-4 md:tw-px-8"},X={key:0,class:"tw-mt-4 tw-mb-6"},Y={class:"tw-text-xl sm:tw-text-4xl"},Z={class:"tw-flex tw-flex-col md:tw-flex-row md:tw-items-center tw-gap-4 tw-mt-4"},ee={class:"tw-w-full"},te={class:"tw-my-6"},Oe={__name:"ISPswSchemes",async setup(se){let f,w;const S=G(),n=Q(),h=J(),c=m(!1),u=m(null),s=m(null),e=m(),d=_(()=>n.ServicesList[51e3]),i=_(()=>h.contractsList[u.value]),B=_(()=>i.value?.Balance>=s.value?.CostPay?"Оплатить с баланса договора":"Добавить в корзину");async function V(){c.value=!0;const{result:I,info:t}=await n.ISPswOrder({ISPswSchemeID:e.value.ID,ContractID:u.value,ServiceID:51e3,DependOrderID:e.value.DependOrderID===-1?null:e.value.DependOrderID,IP:e.value.IP?e.value.IP:null});if(I==="SUCCESS")try{const a=await n.ISPswOrderPay({ISPswOrderID:t.ISPswOrderID,DaysPay:s.value?.actualDays});a==="UseBasket"?S.push("/Basket"):a==="NoBasket"?S.push("/ISPswOrders"):console.error("Ошибка оплаты заказа")}catch(a){console.error("ISPswOrderPay error:",a),c.value=!1}c.value=!1}return M(e,()=>{e.value.Endless&&(s.value={price:e.value.CostMonth})}),[f,w]=R(()=>n.fetchISPswSchemes()),await f,w(),(I,t)=>{const a=K,k=H,C=F,g=T,O=L,b=E,N=A,$=U;return p(),P(z,null,[l(a,{"contract-id":i.value?.ID},null,8,["contract-id"]),o("div",W,[l(k),d.value?(p(),P("div",X,[o("h1",Y,x(d.value.Name),1),l(C,{partition:"Header:/ISPswOrders",class:"tw-mt-4"}),o("div",Z,[t[4]||(t[4]=o("div",{class:"tw-flex-none tw-w-64"},[y(" Выбрать договор "),o("span",{class:"tw-text-red-500 tw-ml-1"},"*")],-1)),o("div",ee,[l(g,{modelValue:u.value,"onUpdate:modelValue":t[0]||(t[0]=r=>u.value=r)},null,8,["modelValue"])])]),l(O,{modelValue:e.value,"onUpdate:modelValue":t[1]||(t[1]=r=>e.value=r),schemes:j(n).ISPswSchemes,service:d.value},null,8,["modelValue","schemes","service"]),!e.value?.Endless&&i.value?(p(),D(b,{key:0,modelValue:s.value,"onUpdate:modelValue":t[2]||(t[2]=r=>s.value=r),contract:i.value,scheme:e.value,"service-id":51e3},null,8,["modelValue","contract","scheme"])):v("",!0),o("div",te,[s.value?(p(),D(N,{key:0,tariff:s.value},null,8,["tariff"])):v("",!0),l($,{disabled:s.value===null||s.value?.price===null,loading:c.value,class:"tw-w-full",onClick:t[3]||(t[3]=r=>V())},{default:q(()=>[y(x(B.value),1)]),_:1},8,["disabled","loading"])])])):v("",!0)])],64)}}};export{Oe as default};
