import{_ as P}from"./ButtonDefault-CzWpVlv6.js";import{am as b,r as d,A as w,v as A,g as B,l as L,D as M,o as t,c as s,a as r,F as c,h as p,n as j,t as f,i as S,b as x}from"./index-Bb2UEb_P.js";import{u as N}from"./invoices-F361lW0u.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);A(()=>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 t(),s("div",V,[l[1]||(l[1]=r("div",{class:"list-item__title"},"Платежные системы",-1)),_.value?(t(),s("div",F,[(t(!0),s(c,null,p(_.value,u=>(t(),s(c,{key:u[0]?.ID},[(t(!0),s(c,null,p(u,a=>(t(),s(c,{key:a.ID},[a.IsActive?(t(),s("div",{key:0,class:j(["list-item",{"list-item_active":i.value==a.Source}]),onClick:K=>i.value=a.Source},[r("img",{class:"list-item__image",src:a.Image},null,8,U),r("div",W,f(a.Description),1)],10,O)):S("",!0)],64))),128))],64))),128))])):S("",!0),r("div",$,f(D.value),1),x(E,{label:"Выбрать","is-loading":m.value,onClick:l[0]||(l[0]=u=>v())},null,8,["is-loading"])])}}},Q=T(z,[["__scopeId","data-v-5204d807"]]);export{Q as default};
