import{$ as d}from"./jquery-Ce1xMU6f.js";import{d as y,r,o as l,c as n,a as e,t as m,b as v,e as u,f as k,F as C,g as N}from"../index.js";const S={class:"modal-dialog"},w={class:"modal-content"},B={class:"modal-header"},D={class:"modal-title"},T=e("button",{type:"button",class:"close","data-dismiss":"modal","aria-label":"Close"},[e("span",{"aria-hidden":"true"},"×")],-1),x={class:"modal-body"},$={key:0},E={key:1},M={class:"modal-footer"},V=e("button",{class:"btn btn-outline-secondary","data-dismiss":"modal","aria-label":"Close"}," Cancel ",-1),A=["disabled","title"],F=e("i",{class:"fa fa-trash"},null,-1),I=["disabled","title"],R=e("i",{class:"fa fa-trash"},null,-1),z=y({__name:"confirmDeleteModal",props:{id:String,loading:Boolean,title:String,itemName:String,buttonTitle:String,buttonDisabled:Boolean},emits:["delete"],setup(t,{emit:b}){const h=b,i=r(!1),s=r(null);async function f(){var a;i.value=!0;const o=N();await((a=o==null?void 0:o.proxy)==null?void 0:a.$nextTick()),d(s.value).on("hidden.bs.modal",c),d(s.value).modal("show")}function _(){h("delete"),g()}function g(){d(s.value).modal("hide"),c()}function c(){i.value=!1}return(o,a)=>(l(),n(C,null,[i.value?(l(),n("div",{key:0,ref_key:"modalElement",ref:s,class:"modal fade",role:"dialog"},[e("div",S,[e("div",w,[e("div",B,[e("h3",D,m(t.title),1),T]),e("div",x,[t.itemName?(l(),n("span",$,"Are you sure you wish to delete "+m(t.itemName),1)):(l(),n("span",E,"Are you sure you wish to delete this item?")),v(o.$slots,"body")]),e("div",M,[V,e("button",{class:"btn btn-danger",onClick:_,disabled:t.loading,title:t.buttonTitle},[F,u(" Confirm delete ")],8,A)])])])],512)):k("",!0),e("button",{class:"btn btn-sm btn-outline-danger delete-btn",disabled:t.loading||t.buttonDisabled,title:t.buttonTitle,onClick:a[0]||(a[0]=j=>f())},[R,u(" Delete ")],8,I)],64))}});export{z as _};
