import{j as w,b as S,d as C,o as t,f as b,a as o,n as d,c as s,t as c,e as n,w as u,h as f,g as k,T as I,M}from"./app-91dba96b.js";const p=["id","aria-labelledby"],x={class:"modal-content border-0 rounded-default"},z=["id"],L=["disabled"],E={__name:"modal",props:{modalId:{type:String,required:!0},title:{type:String,default:"Title"},width:{type:String},showFooter:{type:Boolean,default:!0},preloader:{type:Boolean,default:!1},saveButtonLabel:{type:String,default:function(){return"Save"}},saveButtonIcon:{type:String,default:function(){return"bi-download"}},cancelButtonLabel:{type:String,default:function(){return"Cancel"}},scrollable:{type:Boolean,default:!1},verticallyCentered:{type:Boolean,default:!1},modalSize:{type:String,default:"default"},permission:{type:Boolean,default:!0},showHeader:{type:Boolean,default:!0},showTitle:{type:Boolean,default:!0},showCloseIcon:{type:Boolean,default:!0},bodyClasses:String,headerClasses:String,footerClasses:String},emits:["submit","close"],setup(e,{emit:y}){const l=e,i=y,h=w(()=>l.modalSize==="default"?"":l.modalSize==="small"?"modal-sm":l.modalSize==="large"?"modal-lg":l.modalSize==="extra-large"?"modal-xl":l.modalSize==="fullscreen"?"modal-fullscreen":""),g=()=>{i("submit")},v=()=>{let a=document.getElementById(l.modalId);new M(a).show()},m=()=>{i("close")};return S(()=>{v();let a=document.getElementById(l.modalId),r=document.getElementsByTagName("html")[0];a.addEventListener("hidden.bs.modal",()=>{i("close"),r.style.overflowY="auto"}),a.addEventListener("shown.bs.modal",()=>{r.style.overflowY="hidden"})}),(a,r)=>{const B=C("app-button-loader");return t(),b(I,{to:"body"},[o("div",{class:"modal fade",id:e.modalId,tabindex:"-1","aria-labelledby":`${e.modalId}ModalLabel`,"aria-hidden":"true"},[o("div",{class:d(["modal-dialog",[{"modal-dialog-scrollable":e.scrollable},{"modal-dialog-centered":e.verticallyCentered},h.value]])},[o("div",x,[e.showHeader?(t(),s("div",{key:0,class:d(["modal-header rounded-top",e.headerClasses])},[e.showTitle?(t(),s("h5",{key:0,class:"modal-title",id:`${e.modalId}ModalLabel`},c(e.title),9,z)):n("",!0),e.showCloseIcon?(t(),s("i",{key:1,class:"bi bi-x-circle modal-close",onClick:u(m,["prevent"]),"aria-label":"Close"})):n("",!0)],2)):n("",!0),o("div",{class:d(["modal-body custom-scrollbar",e.bodyClasses,{"overflow-x-hidden":e.scrollable}])},[f(a.$slots,"body")],2),e.showFooter?(t(),s("div",{key:1,class:d(["modal-footer rounded-bottom",e.footerClasses])},[o("button",{type:"button",class:"btn btn-outline-primary me-2 fw-bold","data-bs-dismiss":"modal",onClick:u(m,["prevent"])},c(e.cancelButtonLabel),1),e.permission?(t(),s("button",{key:0,type:"submit",class:"btn btn-primary fw-bold d-flex align-items-center gap-2",onClick:u(g,["prevent"]),disabled:e.preloader},[e.preloader?(t(),b(B,{key:0})):n("",!0),o("i",{class:d(["d-inline-flex bi",e.saveButtonIcon])},null,2),k(" "+c(e.saveButtonLabel),1)],8,L)):n("",!0)],2)):(t(),s("div",{key:2,class:d(["modal-footer rounded-bottom",e.footerClasses])},[f(a.$slots,"footer")],2))])],2)],8,p)])}}};export{E as default};
