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