import{c as o,o as n,a as m,h as f,F as d,i as p,n as A,t as S,ao as M,x,r as D,f as g}from"./index-CipWZKo_.js";import{u as j}from"./invoices-BQ0DRF22.js";import{u as B}from"./postings-dJpYnOCG.js";import{_ as b}from"./_plugin-vue_export-helper-DlAUqK2U.js";const w={props:{data:{type:Object,default:()=>{}}},emits:["modalClose"],setup(u,{emit:i}){const _=M(),s=j(),I=B(),v=x("emitter"),l=D(null),e=g(()=>_.data),r=D(null),C=g(()=>{const a=e.value;return a?.PaymentSystems?Object.keys(a.PaymentSystems).map(t=>{const c=a.PaymentSystems[t];return String(c?.IsActive)==="1"?c.Collations?.slice().sort((h,P)=>parseInt(h.SortID)-parseInt(P.SortID)):null}).filter(t=>t!==null):null});function k(a){r.value={id:a?.ID,type:a?.Source},r.value!==null&&s.InvoiceMake({ContractID:u.data?.ItemID,PaymentSystemID:r.value?.type}).then(t=>{if(t.status==="success"&&t.data&&t.data.InvoiceID){i("modalClose");const c=t.data.InvoiceID;I.InvoiceDocument({InvoiceID:c}).then(y=>{v.emit("open-modal",{component:"InvoiceDocument",data:{html:y,ID:c}})})}else i("modalClose")})}return{getConfig:e,errorMessage:l,filterActiveSystems:C,selectPaymentSystem:k,paymentSystem:r}}},F={class:"list-part"},N={key:0,class:"list-row grid-net"},O=["onClick"],V=["src"],z={class:"list-item__image-title"},E={class:"modal__error"};function L(u,i,_,s,I,v){return n(),o("div",F,[i[0]||(i[0]=m("div",{class:"list-item__title"},"Выбрать платёжную систему",-1)),s.filterActiveSystems?(n(),o("div",N,[(n(!0),o(d,null,p(s.filterActiveSystems,l=>(n(),o(d,{key:l[0]?.ID},[(n(!0),o(d,null,p(l,e=>(n(),o(d,{key:e?.ID},[e?.IsActive?(n(),o("div",{key:0,class:A(["list-item",{"list-item_active":s.paymentSystem?.id===e?.ID}]),onClick:r=>s.selectPaymentSystem(e)},[m("img",{class:"list-item__image",src:e?.Image},null,8,V),m("div",z,S(e?.Description),1)],10,O)):f("",!0)],64))),128))],64))),128))])):f("",!0),m("div",E,S(s.errorMessage),1)])}const J=b(w,[["render",L],["__scopeId","data-v-cd76f50f"]]);export{J as default};
