import{_ as $}from"./ButtonDefault-CzWpVlv6.js";import{_ as L}from"./TotalAmount.vue_vue_type_script_setup_true_lang-BCu2SNOJ.js";import{_ as N}from"./InputSelectService-CZ0-qM8M.js";import{_ as P}from"./InputSelectContract.vue_vue_type_script_setup_true_lang-Dll1Hpi-.js";import{_ as U}from"./ClausesKeeper-CyJ_9bTp.js";import{_ as E}from"./TabsAdditionalServices-Q4t33JY-.js";import{_ as T}from"./BlockBalanceAgreement-396E9Da8.js";import{u as q,r as _,g as i,x as F,o as x,c as C,b as a,a as n,t as R,f as j,B as H,i as K,F as M,j as W,e as X}from"./index-Bb2UEb_P.js";import{u as z}from"./index-Dax_IkAt.js";import{u as G}from"./services-DEZoSah0.js";import{_ as J}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./common-U_VzDrmL.js";import"./BasicInput-BG-lQkv5.js";import"./component-C-Q4t0gB.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";const Q={class:"tw-px-4 md:tw-px-8"},Y={key:0,class:"tw-mt-4 tw-mb-6"},Z={class:"tw-text-xl sm:tw-text-4xl"},ee={class:"tw-flex tw-flex-col md:tw-flex-row md:tw-items-center tw-gap-4 tw-mt-4"},te={class:"tw-w-full"},oe={__name:"AdditionalServicesSchemes",async setup(se){let f,S;const w=W(),p=X(),h=q(),l=G(),g=z(),s=_({}),c=_(!1),u=_(null),I=i(()=>g.contractsList[u.value]),t=i(()=>l.ServicesList[w.query.ServiceID]),D=i(()=>Number(s.value.Price||0)),y=i(()=>I.value?.Balance>D.value?"Оплатить с баланса договора":"Добавить в корзину"),b=i(()=>"1 "+t.value?.Measure);async function O(){c.value=!0;const r={};for(const e of Object.keys(s.value))e.startsWith("ID")&&(r[e]=s.value[e]),e.endsWith("SchemeID")&&(r[e]=s.value[e]),e==="IP"&&(r[e]=s.value[e]);r.DependOrderID=s.value.DependOrderID,r.ContractID=u.value,r.ServiceID=t.value.ID;const{result:o,info:v}=await l.ServiceOrder(r);if(o==="SUCCESS"){const e=await l.serviceOrderPay(t.value.Code,{AmountPay:"1",ServiceOrderID:v?.ServiceOrderID,IsChange:!0},{XMLHttpRequest:"yes"});let{result:m}=e;m==="SUCCESS"?p.push(`/AdditionalServices?ServiceID=${t.value.ID}`):m==="BASKET"&&p.push("/Basket"),c.value=!1}else c.value=!1}return[f,S]=F(()=>h.fetchUserOrders()),await f,S(),l.ServicesList[w.query.ServiceID]||p.push("/404"),(r,o)=>{const v=T,e=E,m=U,A=P,B=N,V=L,k=$;return x(),C(M,null,[a(v,{"contract-id":I.value?.ID},null,8,["contract-id"]),n("div",Q,[a(e),t.value?(x(),C("div",Y,[n("h1",Z,R(t.value?.Item),1),a(m,{partition:`Header:${t.value?.Code==="Default"?t.value.ID:`/${t.value?.Code}Orders`}`,class:"tw-mt-4"},null,8,["partition"]),n("div",ee,[o[3]||(o[3]=n("div",{class:"tw-flex-none tw-w-64"},[j(" Выбрать договор "),n("span",{class:"tw-text-red-500 tw-ml-1"},"*")],-1)),n("div",te,[a(A,{modelValue:u.value,"onUpdate:modelValue":o[0]||(o[0]=d=>u.value=d)},null,8,["modelValue"])])]),a(B,{modelValue:s.value,"onUpdate:modelValue":o[1]||(o[1]=d=>s.value=d),schemes:H(l).additionalServicesScheme[t.value?.Code],service:t.value},null,8,["modelValue","schemes","service"]),n("section",null,[a(V,{tariff:{label:b.value,price:D.value}},null,8,["tariff"]),a(k,{class:"btn--wide",label:y.value,"is-loading":c.value,onClick:o[2]||(o[2]=d=>O())},null,8,["label","is-loading"])])])):K("",!0)])],64)}}},ye=J(oe,[["__scopeId","data-v-6087ba71"]]);export{ye as default};
