import{_ as P}from"./ButtonDefault-BIBStZbJ.js";import{ao as b,r as d,x as w,m as x,f as B,H as L,s as M,c as t,o as s,a as r,h as p,b as j,F as c,i as f,n as A,t as S}from"./index-CmCGXBst.js";import{u as N}from"./invoices-DSyOyjgA.js";import{_ as T}from"./_plugin-vue_export-helper-DlAUqK2U.js";const V={class:"list-part"},F={key:0,class:"list-row grid-net"},O=["onClick"],U=["src"],W={class:"list-item__image-title"},$={class:"modal__error"},z={__name:"ModalWindowInvoiceEdit",props:{data:{type:Object,default:()=>{}}},emits:["modalClose"],setup(I,{emit:g}){const n=I,k=g,o=b(),C=N(),m=d(!1),D=d(null),h=w("emitter"),i=d(null);x(()=>n.data,()=>{i.value=n.data.PaymentSystemID},{immediate:!0});const _=B(()=>o.data.PaymentSystems?Object.keys(o.data.PaymentSystems).map(e=>o.data.PaymentSystems?.[e]?.IsActive==1&&o.data.PaymentSystems?.[e]?.ContractsTypes?.[n.data?.TypeID]==1?o.data.PaymentSystems?.[e]?.Collations:null).filter(e=>e!==null):null);function v(){i.value!==null&&(m.value=!0,C.InvoiceEdit({InvoiceID:n.data?.ItemID,PaymentSystemID:i.value,Summ:n.data?.Summ}).then(e=>{e==="SUCCESS"&&(k("modalClose"),h.emit("updateInvoicesTable")),m.value=!1}))}const y=e=>{e.key==="Enter"&&v()};return L(()=>{document.addEventListener("keyup",y)}),M(()=>{document.removeEventListener("keyup",y)}),(e,l)=>{const E=P;return s(),t("div",V,[l[1]||(l[1]=r("div",{class:"list-item__title"},"Платежные системы",-1)),_.value?(s(),t("div",F,[(s(!0),t(c,null,f(_.value,u=>(s(),t(c,{key:u[0]?.ID},[(s(!0),t(c,null,f(u,a=>(s(),t(c,{key:a.ID},[a.IsActive?(s(),t("div",{key:0,class:A(["list-item",{"list-item_active":i.value==a.Source}]),onClick:H=>i.value=a.Source},[r("img",{class:"list-item__image",src:a.Image},null,8,U),r("div",W,S(a.Description),1)],10,O)):p("",!0)],64))),128))],64))),128))])):p("",!0),r("div",$,S(D.value),1),j(E,{label:"Выбрать","is-loading":m.value,onClick:l[0]||(l[0]=u=>v())},null,8,["is-loading"])])}}},Q=T(z,[["__scopeId","data-v-526e8ba0"]]);export{Q as default};
