import{_ as g}from"./BlueButton.vue_vue_type_script_setup_true_lang-CY8chwQm.js";import{M as x,H as C,o as f,c as p,t as I,i as N,a as l,I as B,r as c,v as k,l as M,D as $,b as w,w as D,f as S}from"./index-Bb2UEb_P.js";import{_ as T}from"./InputSelectContract.vue_vue_type_script_setup_true_lang-Dll1Hpi-.js";import{u as h}from"./index-Dax_IkAt.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./InputSelect.vue_vue_type_script_setup_true_lang-DDGr1dhD.js";import"./IconChevronDown-NfcUpI8U.js";import"./common-U_VzDrmL.js";const E={class:"tw-flex tw-flex-col md:tw-flex-row tw-items-center tw-text-sm tw-gap-4"},F={key:0,class:"tw-w-full md:tw-w-64"},L={class:"tw-w-full md:tw-flex-1"},U=["value","disabled","name","placeholder"],j=x({__name:"InputNumber",props:B({label:{default:""},name:{default:""},placeholder:{default:""},disabled:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(v){const s=C(v,"modelValue");function n(t){const a=t.target.value;if(a===""){s.value=0;return}const d=a.replace(",","."),m=Number(d);isNaN(m)||(s.value=m)}return(t,o)=>(f(),p("div",E,[t.label?(f(),p("div",F,I(t.label),1)):N("",!0),l("div",L,[l("input",{value:s.value,disabled:t.disabled,name:t.name,placeholder:t.placeholder,type:"text",class:"tw-flex tw-justify-center tw-h-10 tw-px-3.5 tw-border tw-border-solid tw-border-gray-200 tw-rounded tw-text-gray-800 tw-placeholder-gray-300 tw-w-full",onInput:n},null,40,U)])]))}}),z={class:"modal__body"},H={class:"tw-flex tw-flex-col md:tw-flex-row md:tw-items-center tw-gap-4 tw-mt-4"},K={class:"tw-w-full"},R=x({__name:"ModalWindowFundsTransfer",emits:["modalClose"],setup(v,{emit:s}){const n=h(),t=c(null),o=c(null),a=c(0),d=c(!1),m=s;k(t,u=>{const e=Object.values(n.contractsList).find(i=>i.ID===u);e&&(a.value=e.Balance)},{immediate:!0});async function _(){d.value=!0,(await n.FundsTransfer({FromContractID:t.value,ToContractID:o.value,Summ:a.value})).status==="success"&&(await n.fetchContracts(),m("modalClose")),d.value=!1}const b=u=>{u.key==="Enter"&&_()};return M(()=>{document.addEventListener("keyup",b)}),$(()=>{document.removeEventListener("keyup",b)}),(u,e)=>{const i=T,V=j,y=g;return f(),p("div",z,[e[5]||(e[5]=l("div",{class:"tw-text-xl sm:tw-text-2xl"},"Перевод средств между счетами",-1)),e[6]||(e[6]=l("div",{class:"tw-mt-4"},"Откуда",-1)),w(i,{modelValue:t.value,"onUpdate:modelValue":e[0]||(e[0]=r=>t.value=r),"has-balance":!0,class:"tw-mt-4"},null,8,["modelValue"]),e[7]||(e[7]=l("div",{class:"tw-mt-4"},"Куда",-1)),w(i,{modelValue:o.value,"onUpdate:modelValue":e[1]||(e[1]=r=>o.value=r),exclude:t.value,class:"tw-mt-4"},null,8,["modelValue","exclude"]),l("div",H,[e[3]||(e[3]=l("div",{class:"tw-flex-none tw-w-48"},"Сумма",-1)),l("div",K,[w(V,{modelValue:a.value,"onUpdate:modelValue":e[2]||(e[2]=r=>a.value=r)},null,8,["modelValue"])])]),w(y,{disabled:t.value===null||o.value===null,loading:d.value,class:"tw-mt-6",onClick:_},{default:D(()=>e[4]||(e[4]=[S(" Перевести ",-1)])),_:1,__:[4]},8,["disabled","loading"])])}}});export{R as default};
